|
From: Vlada D. <dj...@im...> - 2002-11-18 11:45:46
|
Hi.
Maybe I'm a little anoying with this, but I'm really confused. I'm =
trying to get an MDI child window to show when I press File->new in the =
menu, but the window does not show, though its name is appnded to Window =
menu every time I press File->New. After I placed the same code in =
WM_CREATE message handler, the window appeared OK. Why is this? Here's a =
piece of my code:
switch(LOWORD(wParam))
{
case ID_FILE_NEW:
{
if(nChildCount=3D=3D0)//if there are no child =
windows
{
CLIENTCREATESTRUCT ccs;
=
SetMenu(hFrameWnd,LoadMenu(g_hInstance,MAKEINTRESOURCE(IDM_MENU)));//set =
another menu
=
ccs.hWindowMenu=3DGetSubMenu(GetMenu(hFrameWnd),1);
ccs.idFirstChild=3DID_FIRST_CHILD;
=20
=
hMDIClient=3DCreateWindowEx(WS_EX_CLIENTEDGE,"MDICLIENT",(LPCTSTR)NULL,WS=
_CHILD|WS_CLIPCHILDREN,
=
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,hFrameWnd,(HMENU)=
ccs.idFirstChild,
g_hInstance,(LPVOID)&ccs);
if(!hMDIClient)
MessageBox(hFrameWnd,"Can't create client =
wnd","error",MB_OK);
ShowWindow(hMDIClient,SW_SHOW);
=20
}
/*create child window*/
=
hChildWnd=3DCreateMDIWindow(g_sChildClass,"Untitled",WS_HSCROLL|WS_VSCROL=
L,CW_USEDEFAULT,
CW_USEDEFAULT, =
300,200,hMDIClient,g_hInstance,lParam);
if(!hChildWnd)
MessageBox(hFrameWnd,"Can't create child =
wnd","error",MB_OK);
ShowWindow(hChildWnd,SW_SHOW);
UpdateWindow(hChildWnd);
nChildCount++;// increase number of MDI child =
windows
}
break;
Regards,
Vlada
|