Re: Create a WS_CHILD window in another thread with its own WinProc



docschnipp wrote:
Hi,

for a specific reason I want to have a parent window (with a menu bar etc.) and in that a child window. The Child Window is created in a worker thread and uses its own WinProc to receive messages etc.

This works as long I don't use the WS_CHILD style. In this case, a second window opens and is working independently.

But I want to run it inside the other window (like a control).

In this case, when using the WS_CHILD style, I can not register the Class, GetLastError() returns 87 (invalid parameter).

The code for the second window class looks as follows:

mWindowClass.cbSize = sizeof(mWindowClass);
mWindowClass.style = CS_HREDRAW | CS_VREDRAW;
if ( hSystemWindow ) // this means a parent window is defined
{
mWindowClass.style = WS_CHILD | WS_VISIBLE ;
}
mWindowClass.lpfnWndProc = OtherWndProc;
mWindowClass.cbClsExtra = 0;
mWindowClass.cbWndExtra = 0;
mWindowClass.hInstance = (HINSTANCE) hInstance;
mWindowClass.hIcon = LoadIcon(mWindowClass.hInstance,IDI_APPLICATION);
mWindowClass.hCursor = LoadCursor(NULL, IDC_ARROW); // predefined arrow mWindowClass.hbrBackground = (HBRUSH) GetStockObject( WHITE_BRUSH);
mWindowClass.lpszClassName = "innerpanel";
mWindowClass.lpszMenuName = 0;
mWindowClass.hIconSm = 0;

hwndClass = RegisterClassEx(&mWindowClass);

Any hint what I am doing wrong?

thanks
doc

You are putting _window style_ values (WS_CHILD and WS_VISIBLE) in a WNDCLASS element which should get only _class style_ values.

Use WS_CHILD and WS_VISIBLE when you call CreateWindow().

Norm

--
--
To reply, change domain to an adult feline.

.



Relevant Pages

  • Re: how to call a java script function in a child window from the
    ... The htm in the parent window and needs ... The child window displays a contact form that is to be ... I was trying to from the parent window script> ...
    (microsoft.public.frontpage.programming)
  • Re: PostBack
    ... > different from the standard implementation. ... > window in javascript. ... >> I want to call dopostback of parent window from child window. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: In the need for some advice!
    ... int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInnstance, ... PSTR szCmdLine, int iCmdShow) ... //CONFIGURE WINDOW APPLICATION ... //CONFIGURE CHILD WINDOW #1 ...
    (microsoft.public.vc.language)
  • Re: WM_NOTIFY routing
    ... When a control has an event (such as UI ... parent window by sending a WM_NOTIFY message to it. ... >> WM_NOTIFY is sent from the child window to its parent. ...
    (microsoft.public.vc.mfc.docview)
  • Re: CWnd::CreateEx fails with GetLastError 0
    ... which the parent window resides. ... with process having parent window. ... Can this error be due to parent window process OR it is due to child window ... Sometimes i am getting CWnd::CreateEx API failure with GetLastError 0. ...
    (microsoft.public.vc.mfc)