I've looked there, but unfortunately, have only seen the delegate definition without any examples on implementing it. The only reference I've found that comes close is a newsgroup post with someone having the same trouble. Of course, his question went unanswered as well. Luck of the Irish at it's best. lol
JeremyLM
Posts
-
Delegate Help -
Delegate HelpI've search google exhaustively looking for some help with this and can't seem to find anything that has been productive. I have a Dynamic Link Library written in C++ which makes use of a callback: LRESULT CALLBACK eventListener(HWND hWnd, UINT msg, WPARAM wP, LPARAM lP) { ... } I'm trying to write a C# wrapper for this library and cannot seem to find the correct way to form the delegate to make use of the callback. If anyone could point me in the right direction or knows of an example that might be helpful, it would be very much appreciated.
-
Somewhat new to C#...but a long time C/C++ programmer. I've ran in to a bit of a spot that I just can't seem to get a grasp on. I have a callback in a C++ unmanaged DLL that I've written: LRESULT CALLBACK eventListener(HWND hWnd, UINT msg, WPARAM wP, LPARAM lP) { switch(msg) { case WM_PAINT: { PAINTSTRUCT ps; HDC hDc = BeginPaint(GetFocus(), &ps); if(g_currVideo != NULL) { const VideoFrame& currFrame = g_frames[g_currentFrame].frame; BITMAPINFO bi; ZeroMemory(&bi, sizeof(bi)); bi.bmiHeader.biSize = sizeof(bi); bi.bmiHeader.biWidth = currFrame.getWidth(); bi.bmiHeader.biHeight = currFrame.getHeight(); bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 24; SetDIBitsToDevice(hDc, 0, 0, currFrame.getWidth(), currFrame.getHeight(), 0, 0, 0, currFrame.getHeight(), currFrame.getData(), &bi, DIB_RGB_COLORS); } EndPaint(GetFocus(), &ps); return 0; }break; ... } In C++, I would have no problem calling this, however, I am lost when it comes to doing it in C#. The DLL in question relies on the callback to load and play back frames and samples of an uncommon video format. In C#, I'm able to get it as far as loading that first frame and audio sample, however, without the callback, that's as far as I can go. My question is how would I implement use of this callback this in C#?