Calling Default Implementation of Rich Edit OLE Handlers
Michael Iles -- michaeli@dra.com Tuesday, October 08, 1996 Environment: VC++ 4.2a, NT 4.0 This is a followup question to a question posed a while ago. I wanted (and still want :) to receive notification of a drag-and-drop operation in a CRichEditCtrl-derived class. I have learned that this functionality is handled by the OLE 'part' of the object, and to handle it I have added an OLE interface map to my derived class and provided an implementation for all the functions in IRichEditOleCallback. I substitute my functions for the default ones with CRichEditCtrl::SetOleCallback, and this works fine: my handlers are called at the appropriate times. ** My problem is this: I want to be able to call the default implementations of these functions, because I'm only looking for _notification_ of drag-and-drop operations and not customizing the implementation. The obvious solution (to me) seemed to be to get a pointer to the old IRichEditOleCallback before I substituted my new one, which I would then be able to call from my handlers. There is no GetOleCallback method but there is GetIRichEditOle which returns a pointer to a different interface, IRichEditOle. I tried getting this interface and calling QueryInterface through it with IID_IRichEditOleCallback, hoping to receive the original IRichEditOleCallback interface - however, it returns NULL. The documentation on this sort of thing seems to be _extremely_ sparse. I've looked through DejaNews, the online MS KB, 'MFC Internals', .B ekiM's 'Revolutionary Guide to MFC 4', etc. etc. Any help would be greatly appreciated! Mike. ---------------------------------------- Michael Iles, michaeli@dra.com Ceci n'est pas une .sig
Ed Ball -- ed@logos.com Wednesday, October 09, 1996 [Mini-digest: 2 responses] As far as I know, there is no "default" implementation of IRichEditOleCallback -- if you want the rich edit control to do what it would have done had you not provided a callback, return E_NOTIMPL from each method in the callback. This is what MFC does when it provides the callback in CRichEditView -- see XRichEditOleCallback::ContextSensitiveHelp, XRichEditOleCallback::GetClipboardData, and XRichEditOleCallback::GetContextMenu in VIEWRICH.CPP for examples. If all of your callback methods already return E_NOTIMPL, then I'm not sure what the problem is... - Ed >---------- >From: Michael Iles[SMTP:michaeli@dra.com] >Sent: Tuesday, October 08, 1996 8:49 AM >To: 'MFC List' >Subject: Calling Default Implementation of Rich Edit OLE Handlers > > >Environment: VC++ 4.2a, NT 4.0 > >This is a followup question to a question posed a while ago. I wanted >(and still want :) to receive notification of a drag-and-drop operation >in a CRichEditCtrl-derived class. I have learned that this >functionality is handled by the OLE 'part' of the object, and to handle >it I have added an OLE interface map to my derived class and provided >an implementation for all the functions in IRichEditOleCallback. I >substitute my functions for the default ones with >CRichEditCtrl::SetOleCallback, and this works fine: my handlers are >called at the appropriate times. > >** My problem is this: I want to be able to call the default >implementations of these functions, because I'm only looking for >_notification_ of drag-and-drop operations and not customizing the >implementation. > >The obvious solution (to me) seemed to be to get a pointer to the old >IRichEditOleCallback before I substituted my new one, which I would >then be able to call from my handlers. There is no GetOleCallback >method but there is GetIRichEditOle which returns a pointer to a >different interface, IRichEditOle. I tried getting this interface and >calling QueryInterface through it with IID_IRichEditOleCallback, hoping >to receive the original IRichEditOleCallback interface - however, it >returns NULL. > >The documentation on this sort of thing seems to be _extremely_ sparse. >I've looked through DejaNews, the online MS KB, 'MFC Internals', .B >ekiM's 'Revolutionary Guide to MFC 4', etc. etc. > >Any help would be greatly appreciated! >Mike. > > ---------------------------------------- >Michael Iles, michaeli@dra.com >Ceci n'est pas une .sig > > > -----From: Gautam KasturiHey Michael!, The reason you are getting NULL when querying for IRichEditCallback is because there is no IRichEditCallback interface with implementation defined for the richedit control. By using SetOleCallback u are giving the control this interface. I know this sounds wierd to the point of being outrageous, but it is so unless I am thoroughly mistaken. To get around your problem I guess you can provide dummy handlers for all other members of the interface besides the one u are interested in (dragndrop). hope i am of help, gk
Noel Burton-Krahn -- noel@harleystreet.com Thursday, October 10, 1996 Try this: http://www.microsoft.com/kb/developr/visual_c/Q141277.htm or Technical notes 38 and 39 ---------- From: Michael Iles[SMTP:michaeli@dra.com] Sent: Tuesday, October 08, 1996 8:49 AM To: 'MFC List' Subject: Calling Default Implementation of Rich Edit OLE Handlers Environment: VC++ 4.2a, NT 4.0 This is a followup question to a question posed a while ago. I wanted (and still want :) to receive notification of a drag-and-drop operation in a CRichEditCtrl-derived class. I have learned that this functionality is handled by the OLE 'part' of the object, and to handle it I have added an OLE interface map to my derived class and provided an implementation for all the functions in IRichEditOleCallback. I substitute my functions for the default ones with CRichEditCtrl::SetOleCallback, and this works fine: my handlers are called at the appropriate times. ** My problem is this: I want to be able to call the default implementations of these functions, because I'm only looking for _notification_ of drag-and-drop operations and not customizing the implementation. The obvious solution (to me) seemed to be to get a pointer to the old IRichEditOleCallback before I substituted my new one, which I would then be able to call from my handlers. There is no GetOleCallback method but there is GetIRichEditOle which returns a pointer to a different interface, IRichEditOle. I tried getting this interface and calling QueryInterface through it with IID_IRichEditOleCallback, hoping to receive the original IRichEditOleCallback interface - however, it returns NULL. The documentation on this sort of thing seems to be _extremely_ sparse. I've looked through DejaNews, the online MS KB, 'MFC Internals', .B ekiM's 'Revolutionary Guide to MFC 4', etc. etc. Any help would be greatly appreciated! Mike. ---------------------------------------- Michael Iles, michaeli@dra.com Ceci n'est pas une .sig
| Вернуться в корень Архива |