I read "Daniel Bowen, Creating a new MDI child: maximization and focus issues" and got some idea. I should handle redraw and focus issues. Set the client window as MDIS_ALLCHILDSTYLES style and change the function to :
HWND child_createWnd(HWND hwndClient, int x, int y, int w, int h, TCHAR szCaption[], TCHAR szFilename[])
{
HWND hwndChild ;
MDICREATESTRUCT mdicreate ;
int fMax = 0;
if(!childClass) childClass = zw\_child\_registerClass();
mdicreate.szClass = szChildClass ;
mdicreate.szTitle = szCaption ;
mdicreate.hOwner = GetModuleHandle(0) ;
mdicreate.x = CW\_USEDEFAULT ;
mdicreate.y = CW\_USEDEFAULT ;
mdicreate.cx = CW\_USEDEFAULT ;
mdicreate.cy = CW\_USEDEFAULT ;
mdicreate.style = `WS_OVERLAPPEDWINDOW | WS_CHILD | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL;`
mdicreate.lParam = (LPARAM)szFilename ;
`SendMessage(hwndClient, WM_SETREDRAW, FALSE, 0); /* Disable redraw */`
hwndChild = (HWND) SendMessage (hwndClient,
WM\_MDICREATE, 0,
(LPARAM) (LPMDICREATESTRUCT) &mdicreate) ;
`/* Should maximize? */ SendMessage(hwndClient, WM_MDIGETACTIVE, 0, &fMax); fMax? ShowWindow(hwndChild, SW_MAXIMIZE) : ShowWindow(hwndChild, SW_NORMAL); /* Handle focus here */ SetFocus(hwndChild); /* Enable and redraw */ SendMessage(hwndClient, WM_SETREDRAW, TRUE, 0); RedrawWindow(hwndClient, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);`
return hwndChild;
Right now everything is correct except very slow. If you have better idea, please let me know, thanks.