i put "
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
mov eax,TRUE
ret
"
in a dialog procude instead of dialog message manage to handle the message,it ml and link well,but it not feedback to the message.


DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_INITDIALOG
invoke GetDlgItem, hWnd,IDC_EDIT
invoke SetFocus,eax
.ELSEIF uMsg==WM_CLOSE
invoke SendMessage,hWnd,WM_COMMAND,IDM_EXIT,0
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
.IF lParam==0
.IF ax==IDM_GETTEXT
invoke GetDlgItemText,hWnd,IDC_EDIT,ADDR buffer,512
invoke MessageBox,NULL,ADDR buffer,ADDR AppName,MB_OK
.ELSEIF ax==IDM_CLEAR
invoke SetDlgItemText,hWnd,IDC_EDIT,NULL
.ELSEIF ax==IDM_EXIT
invoke EndDialog, hWnd,NULL
.ENDIF
.ELSE
mov edx,wParam
shr edx,16
.if dx==BN_CLICKED
.IF ax==IDC_BUTTON
invoke SetDlgItemText,hWnd,IDC_EDIT,ADDR TestString
.ELSEIF ax==IDC_EXIT
invoke SendMessage,hWnd,WM_COMMAND,IDM_EXIT,0
.ENDIF
.ENDIF
.ENDIF
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
mov eax,TRUE
ret
.ENDIF
mov eax,TRUE
ret
DlgProc endp


online waiting for help
Posted on 2004-11-10 01:53:17 by geegle
You are not supposed to add that line for dialogbox.
Posted on 2004-11-10 02:35:45 by roticv
You are not supposed to add that line for dialogbox.


why?
Posted on 2004-11-10 02:58:27 by geegle
Quote:
--------------------------------------------------------------------------------
Originally posted by roticv:
You are not supposed to add that line for dialogbox.
--------------------------------------------------------------------------------



why?

A window procedure needs to call DefWindowProc if the message is not processed to enable the system to process the message if necessary. However a dialog procedure is different. The system itself does all default processing of messages, so it is wrong to call DefWindowProc.
Posted on 2004-11-10 03:17:29 by jorgon
if there is a message,the dialog box manage send it to we
DlgProc,if we processed the message,we return TURL to dialog box manage,then the manage do nothing.if we not process the message,we return 0 to dialog box manage.then dialog box will processed the message.

i means we can first processed the message use DefWindowProc in our
DlgProc instead of use dialog box manage to process it ,then return TURL to dialog box manage.it seems right.but actually it is wrong.

i want to know why we can't use DefWindowProc function.

thanks to all.
Posted on 2004-11-10 04:24:57 by geegle
As I understand it, the system's dialog procedure does not call DefWindowProc, but instead calls DefDlgProc to carry out default message processing.
Posted on 2004-11-10 04:45:48 by jorgon
geegle,

The design is specified by Microsoft who wrote the operating system. Dialogs are a subsystem of creating windows that has been simplified in a number of ways.

If you want full manual control, use CreateWindowEx(), if you want the ease of dialogs, use the specified methods to run them. Below is the operating system defined method of processing messages for a dialog window.


; ?????????????????????????????????????????????????????????????????????????

DlgProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

.if uMsg == WM_INITDIALOG

; -------------------------------------
; return 1 to set focus to 1st control
; -------------------------------------
mov eax, 1
ret

.elseif uMsg == WM_COMMAND
.if wParam == IDOK
; ------------------------
; code for OK button here
; ------------------------
.elseif wParam == IDCANCEL
jmp quit_dialog
.endif

.elseif uMsg == WM_CLOSE
quit_dialog:
invoke EndDialog,hWin,0

.endif

; -------------------------------
; return zero for default action
; -------------------------------
xor eax, eax
ret

DlgProc endp

; ?????????????????????????????????????????????????????????????????????????
Posted on 2004-11-10 05:52:41 by hutch--
hutch,thank you.
i know how to write dialog produce.but what i want to know is the
mechanism of model dialog box.

dialog also is a window,so i think DefWindowProc can process a window

message it also can rocess a dialog box message.

i have a try as the above post,it compiled and run well.but when i

click
the maximize and minimize,it do noting.

i guess the reason this happen is lParam and wParam.
when dialog box manager send message to the produce,it let the value
in lParam and wParam different from that from a normal window.
when the DefWindowProc check the lParam or wParam from a window,it gose

well but a dialog box.
Posted on 2004-11-10 09:06:38 by geegle
AFAIK, this is how it works:

When a message for a dialog box arrives, the system will call the window procedure for it. The window procedure for dialog boxes of the default class will call the dialog box procedure.

Then, if the return value from the dialog box procedure is FALSE the DefDlgProc function will be called (instead of DefWindowProc) to process the remaining messages. If the return value was TRUE, the message is assumed to have been processed and nothing else is done.

Remember that dialog boxes have two procedures: the window and dialog box procedures.

Hope that made things clear. :)
Posted on 2004-11-10 13:49:06 by QvasiModo
AFAIK, this is how it works:

When a message for a dialog box arrives, the system will call the window procedure for it. The window procedure for dialog boxes of the default class will call the dialog box procedure.

Then, if the return value from the dialog box procedure is FALSE the DefDlgProc function will be called (instead of DefWindowProc) to process the remaining messages. If the return value was TRUE, the message is assumed to have been processed and nothing else is done.

Remember that dialog boxes have two procedures: the window and dialog box procedures.

Hope that made things clear. :)


well,all of that i have know.
but the things what pazzled me is why DefWindowProc in our window procedure do noting.
Posted on 2004-11-10 17:48:46 by geegle