News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

EM_SETOLECALLBACK for a richedit

Started by ToutEnMasm, September 09, 2005, 12:52:50 PM

Previous topic - Next topic

ToutEnMasm

Hello,
I try to insert images and the like in a richedit.I have got several samples (c++ and power basic) that send the message EM_SETOLECALLBACK to the richedit before calling EM_GETOLEINTERFACE.
This message call only IRichEditOleCallback_AddRef , and it is when he returns that there is one error

With masm , when i call EM_GETOLEINTERFACE , i have an access violation.
Is there some Help here or some sample in masm ?
                              ToutEnMasm


.code
               WM_CREATE
                Hredit = handle to richedit
               invoke SendMessage,Hredit,EM_SETOLECALLBACK, 0,addr Com_Data.ppv
.data

Com_Data OLERICHEDITCALLBACK <offset vtablecallback,0,0,0>

vtablecallback dd IRichEditOleCallback_QueryInterface
dd IRichEditOleCallback_AddRef
dd IRichEditOleCallback_Release
dd IRichEditOleCallback_GetNewStorage
dd IRichEditOleCallback_GetInPlaceContext
dd IRichEditOleCallback_ShowContainerUI
dd IRichEditOleCallback_QueryInsertObject
dd IRichEditOleCallback_DeleteObject
dd IRichEditOleCallback_QueryAcceptData
dd IRichEditOleCallback_ContextSensitiveHelp
dd IRichEditOleCallback_GetClipboardData
dd IRichEditOleCallback_GetDragDropEffect
dd IRichEditOleCallback_GetContextMenu

ToutEnMasm

Hello,
After searching,it seems that the IRichEditOleCallback has one parameter added to all of it's proto.
Only power basic and masm need to use it.    :green   
The c++ use proto as declare in richole.h.
If someone could explain me why it is like that ,I would be glad to ear it.
                           ToutEnMasm


Tedd

It's the 'this' pointer - it points to the object you're using.
All of the functions in the vtable need to know which object they're supposed to act on - this is done automagically for you in C++. It's just OOP stuff :wink
So your extra parameter is the first one, which is normally 'hidden' because the (C++) compiler takes care of it for you. But in the case of masm, you have to do it yourself.
No snowflake in an avalanche feels responsible.