pinvoke with callbacks

  • Thread starter Thread starter Brad Williams
  • Start date Start date
B

Brad Williams

What is the most C# and managed way to call this Win32 API (providing
callback of course):

BOOL EnumChildWindows(HWND hWndParent, WNDENUMPROC lpEnumFunc, LPARAM
lParam);

I realize how to do with unmanaged C++, but I'm not sure how far one can get
away from that approach and get closer to managed C#.

Thanks!
 
Brad,
What is the most C# and managed way to call this Win32 API (providing
callback of course):

You declare a delegate with the same signature as the callback
function, and pass a delegate refering to your callback hander method
to the function. For an example, see

%FrameworkSDKDir%\v1.1\Samples\Technologies\Interop\PlatformInvoke\WinAPIs\CS\GCHandle.cs



Mattias
 
Back
Top