im made a little test app that when you click on the menu a mdi child will be made. the problem is when i maximize the child the minimize and maximize buttons will no longer work. here is the code can someone take a look at it and tell me what im missing. you can cut and paste this or just download the asm file and use that. thanks.
.586

.model flat, stdcall
option casemap :none

include /masm32/include/windows.inc
include /masm32/include/kernel32.inc
include /masm32/include/user32.inc
include /masm32/include/comctl32.inc
include /masm32/include/Gdi32.inc

includelib /masm32/lib/kernel32.lib
includelib /masm32/lib/user32.lib
includelib /masm32/lib/comctl32.lib
includelib /masm32/lib/Gdi32.lib

WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
TopXY PROTO :DWORD,:DWORD
MakeMDIchild PROTO
MDIclass PROTO

.data
ClassName db "Starting Template",0
CaptionText db "Template",0
tMenu db "Create New MDI Child",0
mdiCl db "MDICLIENT",0
MDIchildClass db "mdi_child",0
tText db "We Just Made This",0

.data?
hWnd HANDLE ?
hInstance HANDLE ?
hEdit1 HANDLE ?
hMenu HANDLE ?
hClient HANDLE ?
cc CLIENTCREATESTRUCT <?>
mdi WNDCLASSEX <?>

.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke WinMain,hInstance,NULL,NULL,SW_SHOWDEFAULT
invoke ExitProcess,eax

; ####################################

WinMain proc hInst:DWORD, hPrevIns:DWORD, CmdLine:DWORD, CmdShow:DWORD

LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
LOCAL Wwd :DWORD
LOCAL Wht :DWORD
LOCAL Wtx :DWORD
LOCAL Wty :DWORD

mov wc.cbSize, SIZEOF WNDCLASSEX
mov wc.style, CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
mov eax, hInstance
mov wc.hInstance, eax
invoke LoadIcon, NULL,IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
invoke LoadCursor, NULL,IDC_ARROW
mov wc.hCursor, eax
mov wc.hbrBackground,COLOR_BTNFACE+1
mov wc.lpszMenuName, NULL
mov wc.lpszClassName,OFFSET ClassName
invoke RegisterClassEx, addr wc

mov Wwd, 500
mov Wht, 350

invoke GetSystemMetrics,SM_CXSCREEN
invoke TopXY,Wwd,eax
mov Wtx, eax

invoke GetSystemMetrics,SM_CYSCREEN
invoke TopXY,Wht,eax
mov Wty, eax

invoke CreateWindowEx, NULL,
ADDR ClassName,
ADDR CaptionText,
WS_OVERLAPPEDWINDOW,
Wtx,Wty,Wwd,Wht,
NULL,
NULL,
hInst,
NULL
mov hWnd,eax
invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd

StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0
cmp eax, 0
je ExitLoop
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop
ExitLoop:

mov eax,msg.wParam
ret

WinMain endp

; #################################

WndProc proc hWin:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

.IF uMsg == WM_CREATE
invoke InitCommonControls
invoke CreateMenu
mov hMenu,eax
invoke AppendMenu,hMenu,MF_POPUP + MF_STRING,8000,addr tMenu
invoke SetMenu,hWin,hMenu

invoke MDIclass


invoke GetSubMenu,hMenu,1
mov cc.hWindowMenu,eax
mov cc.idFirstChild,100
invoke CreateWindowEx, WS_EX_CLIENTEDGE,
addr mdiCl,
0,
WS_CHILD + WS_VISIBLE,
0,0,0,0,
hWin,
0,
hInstance,
ADDR cc
mov hClient, eax

.ELSEIF uMsg == WM_COMMAND
.if wParam == 8000
invoke MakeMDIchild
.endif

.ELSEIF uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
.ELSE
invoke DefFrameProc,hWin,hClient,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret

WndProc endp

; ####################################

MDIproc proc hwnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
;// nothing to do here yet
invoke DefMDIChildProc,hwnd,uMsg,wParam,lParam
ret
MDIproc endp

; ####################################

MDIclass proc

mov mdi.cbSize, SIZEOF WNDCLASSEX
mov mdi.style, CS_BYTEALIGNWINDOW
mov mdi.lpfnWndProc, OFFSET MDIproc
mov mdi.cbClsExtra, NULL
mov mdi.cbWndExtra, NULL
mov eax, hInstance
mov mdi.hInstance, eax
mov mdi.hbrBackground,COLOR_WINDOW+1
mov mdi.lpszClassName,OFFSET MDIchildClass
invoke RegisterClassEx, addr mdi

ret

MDIclass endp

; ####################################

MakeMDIchild proc
LOCAL hChild:HANDLE
invoke CreateWindowEx,WS_EX_MDICHILD,
ADDR MDIchildClass,
addr tText,
0,;WS_MAXIMIZE,
0,0,200,200,
hClient,
100,
hInstance,
0

mov hChild, eax
invoke ShowWindow,hChild,SW_NORMAL

ret
MakeMDIchild endp


; ####################################

TopXY proc wDim:DWORD, sDim:DWORD

shr sDim, 1
shr wDim, 1
mov eax, wDim
sub sDim, eax
mov eax,sDim
ret

TopXY endp

; ####################################

end start
Posted on 2002-05-18 15:14:52 by smurf
Thats a weird error you got there smurf, everything looks like it should work... Anyways, I've attached an MDI program I made for a group project I'm helping out with, It's just the all the required MDI stuff, I hope you find it useful.... might even beable to find your error with a closer look by some comparing.


James
Posted on 2002-05-18 16:29:43 by JamesE
after looking at your code i still couldnt figure out what was going on. so i was competely turned my program upside down making a complete rewrite and comparing to my old program as i went and it was the stupid ret i was using in in the WM_COMMAND message. well anyways 10 hours or so down the drain i finally can move on.
Posted on 2002-05-18 19:24:03 by smurf