刚开始学习win32的编程,在一道“窗口中弹出对话框”的程序中发现这样的问题,恳请大家帮我解决啊。
在主窗口中弹出对话框后,对话框的边框消失了,仅留控件在。(具体现象在附件里)
源程序主要部分如下:
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke InitCommonControls
invoke GetCommandLine
mov CommandLine,eax
invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst :dword,
hPrevInst :dword,
CmdLine :dword,
CmdShow :dword
local wc :WNDCLASSEX
local msg :MSG
local Wwd :dword
local Wht :dword
local Wtx :dword
local Wty :dword
local rectClient :RECT
invoke LoadMenu,hInstance,addr MENUNM
mov hmenu,eax
mov wc.cbSize,sizeof WNDCLASSEX
mov wc.style ,CS_VREDRAW+CS_HREDRAW
mov wc.lpfnWndProc,offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,offset MENUNM
mov wc.lpszClassName,offset szClassName
mov wc.hIcon,0
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
mov wc.hIconSm,0
invoke RegisterClassEx,addr wc
mov Wwd,600
mov Wht,400
mov Wtx,10
mov Wty,10
invoke CreateWindowEx,
WS_EX_ACCEPTFILES+WS_EX_APPWINDOW,
addr szClassName,
addr szDisplayName,
WS_OVERLAPPEDWINDOW,
Wtx,Wty,Wwd,Wht,
NULL,hmenu,hInst,NULL
mov hWnd,eax
INVOKE ShowWindow, hWnd,SW_SHOWNORMAL
INVOKE UpdateWindow, hWnd
invoke CreateWindowEx,
WS_EX_ACCEPTFILES or WS_EX_CLIENTEDGE,
addr szEditClass,
NULL,
WS_CHILD+WS_VISIBLE+WS_HSCROLL+WS_VSCROLL\
+ES_MULTILINE+ES_AUTOVSCROLL+ES_AUTOHSCROLL,
rectClient.left,
rectClient.top,
rectClient.right,
rectClient.bottom,
hWnd,
0,hInst,0
mov hWndEdit1,eax
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 uses ebx edi esi hWin :dword,
uMsg :dword,
wParam :dword,
lParam :dword
local hDlgWnd :dword
.if uMsg == WM_COMMAND
.if wParam == 1000
invoke FileOpen,addr szOpenFileName
.elseif wParam ==1100
invoke MessageBox,hWin,addr TheText,addr szDisplayName,MB_YESNO
.if eax ==IDNO
mov eax,0
ret
.endif
invoke FileSave,addr szSaveFileName
.elseif wParam ==1900
invoke MessageBox,hWin,addr AboutMsg,addr szDisplayName,MB_OK
.elseif wParam ==1200
invoke DialogBoxParam,hInstance,addr TEXTDLGNM,hWin,addr DialogProc,NULL
.elseif wParam ==1300
invoke DialogBoxParam,hInstance,addr TEXTDLGNM,hWin,addr DialogProc,NULL
.endif
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret
.endif
mov eax,0
ret
WndProc endp
;------------------------------------------
DialogProc proc uses ebx edi esi DlghWnd,DlgMsg,wParam,lParam
local Dlgbuf1[20]:byte
local Dlgbuf2[20]:byte
mov eax,DlgMsg
.if eax==WM_CLOSE
invoke EndDialog,DlghWnd,NULL
.elseif eax==WM_INITDIALOG
invoke LoadIcon,DlghWnd,ICO_MAIN
invoke GetDlgItem,DlghWnd,IDC_EDIT1
MOV EDIT_1,EAX
invoke GetDlgItem,DlghWnd,IDC_EDIT2
MOV EDIT_2,EAX
;invoke SendMessage,EDIT_1,WM_COMMAND,ICO_MAIN,WM_INITDIALOG
; invoke SendMessage,EDIT_2,WM_COMMAND,ICO_MAIN,WM_INITDIALOG
.elseif eax==WM_COMMAND
mov eax,wParam
.if ax==IDCANCEL
invoke EndDialog,DlghWnd,NULL
.elseif ax==IDOK
mov cx ,sizeof Dlgbuf1
invoke EndDialog,DlghWnd,TRUE
.elseif ax==IDC_EDIT1
invoke GetDlgItemText,hWnd,IDC_EDIT1,addr Dlgbuf1,sizeof Dlgbuf1
.elseif ax==IDC_EDIT2
invoke GetDlgItemText,hWnd,IDC_EDIT2,addr Dlgbuf2,sizeof Dlgbuf2
.else
mov eax,FALSE
ret
.endif
.endif
mov eax,TRUE
ret
DialogProc endp