what does “OLE The application called an interface

2019-08-07 05:28发布

问题:

I'm still trying to figure out the answer to this question. I would appreciate a nudge in the right direction (since I have very little experience in OLE). Did anyone encounter a similar error after calling RevokDragDrop?

thanks,

回答1:

You passed marshaled interface into a different apartment. An attempt to call a method revealed this and the call aborted with this error RPC_E_WRONG_THREAD.

You should be careful using interface pointers on multiple threads. If you intend to use a pointer that you already hold from a different thread, you have to think it over whether you are allowed to or you need explicitly marshal/unmarshal the pointer for such use, e.g. with CoMarshalInterThreadInterfaceInStream function.

I suppose that the source of the problem is GetProp/SetProp API used. Those store raw pointers as they are without marshaling necessary on the way.



标签: c++ com ole