03-02-2007, 11:55 AM
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("Dialog23" &Dialog23)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;END DIALOG
;DIALOG EDITOR: "" 0x2020002 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,ifk(Z)
,,;here add code to clear edit control etc
,,ret
ret 1
You can remove Cancel button. When you click X or press Esc, dialog procedure receives the same command like you would click Cancel. Then you can check for Esc key state...
Another way:
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("Dialog23" &Dialog23)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;END DIALOG
;DIALOG EDITOR: "" 0x2020002 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_CLOSE
,DT_Cancel hDlg
,ret 1
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,,;here add code to clear edit control etc
,,ret
ret 1