10. srpna 2012 15:30
I am writing an application which must load a dll written in unmanaged c++ and execute an exported function
THE DECLARATION IN THE DLL:
extern "C" __declspec(dllexport) __stdcall void MyFunc( IDispatch* pDispApp );
public static extern void MyFunc([MarshalAs(UnmanagedType.IDispatch)ref Object dispVar );
MyFunc( "THIS IS WHERE I AM LOST") <----- What goes in here? I need to pass an IDispatch pointer (Outlook Application Object)
I haven't found a sample yet.
- Upravený TSRACT 11. srpna 2012 22:42 clarification
11. srpna 2012 6:00
i;m not sure but i would try using Marshal class and function like GetIUnknownForObject and later query for IDispatch (or use standard .net techniques and define IDispatch interface in .net and simply use casting). Also i would change your dllimport signature from ref object to simply IntPtr (or that IDispatch if you will define it in .net)
11. srpna 2012 22:40Thanks for going where others fear to tred :)
I'll give this a go later this evening and let you know how it goes.