I have a third party unmanaged DLLs which requries a window handle to do some painting on. My attempts have been to pass the control::handle property to this DLLs.

The DLLs declaration expects a void* hWnd. Below is the declaration.
CyResult CyDisplayEx:: Open ( void * aWindow,

unsigned short aColumns = 1,

unsigned short aRows = 1,

bool aFullScreen = false

) [virtual]

What I did was is follows.
Panel* test = new Panel();
System:: Intptr handle = test->Handle;

void __pin* hwnd = (void*)handle;

CyDisplayEx:: Open(hwnd, 1,1, false);

The result & problem
The unmanaged DLL starts painting in the window area. It continues to update with significant flickering. At this point, I have not managed any of the paint event to that window.

Additional information about the 3rd party DLL.
I know that the DLL uses directdraw to paint in the window. It also has the following notes:
On Windows, the aWindow parameter must be a valid HWND (WIN32 SDK).
It is important that the userí»s window handling call the following functions on specific Windows events:

I have been strugling with this for almost a week Tongue Tied If anyone has any insight, PLEASE don't hesitate to help.


Re: Visual C++ Language passing control handle to unmanaged directx dlls to paint - result is flickering!

Bite Qiu - MSFT

From the note part it seems that the third-party DLL is intended to work with MFC clients, I would suggest you to contact the library support team and make sure it can actually work with windows form project, and if they say yes, ask them for more documentations to instruct you to get things done.