Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

HWND and Windows Form

$
0
0

Hi,

I am writing an application that mixes Windows Form and HWND. Basically, I have a Form class that has controls on it and I want to instantiate it somewhere else and manipulate it via a handle.

MyForm win;

	 

HWND hWnd = (HWND)win->Handle.ToPointer();


//win.Show();
ShowWindow(hWnd, 3); 
    

MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0))
{
        TranslateMessage(&msg);
        DispatchMessage(&msg);
}

The problem is that when I display the window using the ShowWindow on the HANDLE, the Form shows up but with no control on it, whereas the win.Show() displays the Form with all the controls.

Does anyone have an idea about why?

Many thanks


Viewing all articles
Browse latest Browse all 1710

Trending Articles