Hello, applications use something like the following code in order to pass a custom parameter to a newly created MDI child: MDICREATESTRUCT cs; ... cs.lParam = pointer_to_some_data; SendMessage(hwndMDIClient, WM_MDICREATE, 0, &cs); This approach currently doesn't work in Wine. Windows passes different parameters in the WM_CREATE message depending whether an MDI child is being created by sending the WM_MDICREATE message or by calling CreateMDIWindow API. I'll write a test case for this soon. Changelog: Dmitry Timoshkov <dmitry@xxxxxxxxxxxxxxx> Pass either user defined parameter or address of the MDICREATESTRUCT as the last parameter to CreateWindowEx depending whether an MDI child is being created by sending the WM_MDICREATE message or by calling CreateMDIWindow. P.S. Windows allows to just call DefWindowProc in the custom MDI children and manages to process activation and all other MDI specific things correctly. I don't see a way to handle that in Wine without complete revamping and merging of DefWindowProc/DefMDIChildProc, basing code paths on WS_EX_MDICHILD style. Moreover, it looks like Windows simply forwards CreateMDIWindow to CreateWindowEx without any special processing, which confirms that DefWindowProc has to handle MDI children internally. Any ideas how to proceed without breaking too much assumptions in the current code? --- cvs/hq/wine/windows/mdi.c 2003-12-13 16:28:41.000000000 +0800 +++ wine/windows/mdi.c 2003-12-27 00:01:29.000000000 +0800 @@ -483,7 +483,7 @@ static LRESULT MDIRefreshMenu( HWND hwnd /********************************************************************** * MDICreateChild */ -static HWND MDICreateChild( HWND parent, MDICLIENTINFO *ci, +static HWND MDICreateChild( HWND parent, MDICLIENTINFO *ci, DWORD exStyle, LPMDICREATESTRUCTA cs, BOOL unicode ) { POINT pos[2]; @@ -538,18 +538,20 @@ static HWND MDICreateChild( HWND parent, if( wndParent->flags & WIN_ISWIN32 ) { + LPARAM lParam = (exStyle & WS_EX_MDICHILD) ? (LPARAM)cs : cs->lParam; + WIN_ReleaseWndPtr( wndParent ); if(unicode) { MDICREATESTRUCTW *csW = (MDICREATESTRUCTW *)cs; hwnd = CreateWindowW( csW->szClass, csW->szTitle, style, csW->x, csW->y, csW->cx, csW->cy, parent, - (HMENU)wIDmenu, csW->hOwner, csW ); + (HMENU)wIDmenu, csW->hOwner, (LPVOID)lParam ); } else hwnd = CreateWindowA( cs->szClass, cs->szTitle, style, cs->x, cs->y, cs->cx, cs->cy, parent, - (HMENU)wIDmenu, cs->hOwner, cs ); + (HMENU)wIDmenu, cs->hOwner, (LPVOID)lParam ); } else { @@ -1224,6 +1226,8 @@ static LRESULT MDIClientWndProc_common( { MDICLIENTINFO *ci; + TRACE("%p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam); + if (!(ci = get_client_info( hwnd ))) return 0; switch (message) @@ -1302,7 +1306,8 @@ static LRESULT MDIClientWndProc_common( case WM_MDICREATE: if (lParam) - return (LRESULT)MDICreateChild( hwnd, ci, (MDICREATESTRUCTA *)lParam, unicode ); + return (LRESULT)MDICreateChild( hwnd, ci, 0, + (MDICREATESTRUCTA *)lParam, unicode ); return 0; case WM_MDIDESTROY: @@ -1826,7 +1831,7 @@ HWND WINAPI CreateMDIWindowA( MDICLIENTINFO *pCi = get_client_info( hWndParent ); MDICREATESTRUCTA cs; - TRACE("(%s,%s,%ld,%d,%d,%d,%d,%p,%p,%ld)\n", + TRACE("(%s,%s,%08lx,%d,%d,%d,%d,%p,%p,%08lx)\n", debugstr_a(lpClassName),debugstr_a(lpWindowName),dwStyle,X,Y, nWidth,nHeight,hWndParent,hInstance,lParam); @@ -1845,7 +1850,7 @@ HWND WINAPI CreateMDIWindowA( cs.style=dwStyle; cs.lParam=lParam; - return MDICreateChild(hWndParent, pCi, &cs, FALSE); + return MDICreateChild(hWndParent, pCi, WS_EX_MDICHILD, &cs, FALSE); } /*********************************************************************** @@ -1870,7 +1875,7 @@ HWND WINAPI CreateMDIWindowW( MDICLIENTINFO *pCi = get_client_info( hWndParent ); MDICREATESTRUCTW cs; - TRACE("(%s,%s,%ld,%d,%d,%d,%d,%p,%p,%ld)\n", + TRACE("(%s,%s,%08lx,%d,%d,%d,%d,%p,%p,%08lx)\n", debugstr_w(lpClassName), debugstr_w(lpWindowName), dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam); @@ -1889,7 +1894,7 @@ HWND WINAPI CreateMDIWindowW( cs.style = dwStyle; cs.lParam = lParam; - return MDICreateChild(hWndParent, pCi, (MDICREATESTRUCTA *)&cs, TRUE); + return MDICreateChild(hWndParent, pCi, WS_EX_MDICHILD, (MDICREATESTRUCTA *)&cs, TRUE); } /**********************************************************************