I try to enter COM from the client side using IActiveDesktop as a sample. I instance the interface (eax==S_OK) and use the pointer I get as follows
I get E_INVALIDARG error. The definitions are: cchWallpaper DWORD 0 pwszWallpaper WORD MAX_PATH DUP (0) Any ideas? vesa
mov eax, pIAD mov edx, invoke (IActiveDesktop ptr ).IActiveDesktop_GetWallpaper, ADDR pwszWallpaper,\ cchWallpaper, NULL
I think, you should tell the function the size of the string buffer, so cchWallpaper must be MAX_PATH.
beaster, I have tried MAX_PATH, too. I think the first two parameters are for output, not sure. SDK platform doesn't tell anything. vesa
According to SHLOBJ.H, IActiveDesktop::GetWallpaper is defined as so:
You didn't include the definition of IActiveDesktop you are using, so I can't check that. ::GetWallpaper is the 2nd method of an interface inherited from IUnknown (3 methods), so it's the 5th dword pointer in the vtable. Putting these together leads to the proper prototype to invoke this method:
STDMETHOD (GetWallpaper)(THIS_ LPWSTR pwszWallpaper, UINT cchWallpaper, DWORD dwReserved) PURE;
OR.... (assuming your interface is correct)
mov ecx, pIAD mov edx, push NULL push cchWallpaper push ADDR pwszWallpaper push ecx call ; 5 dwords into the list is 4*4=16 bytes
Note how I avoid using eax for the object pointer (it's needed for the ADDR), and how I also place THIS in the parameter list.
mov ecx, pIAD mov edx, invoke (IActiveDesktop ptr ).IActiveDesktop_GetWallpaper, ecx, ADDR pwszWallpaper, cchWallpaper, NULL
Ernie, shame on me. I didn't read your docs close enough! Thanks! beaster, the second parameter is for input, too. vesa This message was edited by vesa, on 6/29/2001 9:23:55 AM