End Google Ads 201810 - BS.net 01 -->
Hi
In my program I call a win32 API function which returns a function pointer as its result. How can I store and 'call' this pointer in C#?
The API function in question is LRESULT SendMessage(...), which I map as IntPtr SendMessage(...). The function whose pointer is returned by SendMessage has the form
int fn(void*, int);
so I created a delegate
delegate int RemoteFunction(IntPtr a, int b)
and I try to convert the IntPtr (originally LRESULT) returned by SendMessage to an 'instance' of this delegate, like
RemoteFunction x = (RemoteFunction) SendMessage(...); // compiler error
So far I wasn't able to come up with a code that would at least compile, not to mention work.
Do you have any suggestions?
Any help appreciated, H.
مواقع النشر (المفضلة)