See second post first.
I have one window and two children dialogs with buttons and static texts:
invoke CreateWindowEx ....
invoke CreateDialogParam,hInstance,addr DlgName,hWnd,addr WndProcDlg_1,NULL
mov dlgHWnd_1,eax
invoke CreateDialogParam,hInstance,addr SubDlgName,hWnd,addr WndProcDlg_2,NULL
mov dlgHWnd_2,eax
I need to change static text from dialog 1 by clicking a button on dialog 2.
First I try to change static text on dialog 2 self.
WndProcDlg_2 proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
invoke GetDlgItem,dlgHWnd_2,1002 ;CONTROL "SUBWINDOW",IDC_STC2,"Static",...
mov hDlgWndStaticText,eax
invoke SetWindowText, hDlgWndStaticText, ADDR Text_1 ; Text_1 db 'SystemTray',0
I click on button and nothing happend.
I have parent window and two children dialogs.
I passed them different procedures in CreateDialogParam (post above).
Why dialogs share the same procedure from parent window? How to assign them their own procedure?
invoke sendmessage,Hdialbox,WM_SETTEXT,,
Where Hdialbox is the handle in the dlg wnproc,see the exact syntax of WM_SETTEXT to put the address of the string in the correct place.
ToutEnMasm
SetDlgItemText (http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/setdlgitemtext.asp)?
Try it !
ToutEnMasm
Ok, but my question now is:
Why dialogs share the same window procedure from parent window? How to assign them their own procedure?
You give the address of the dialog procedure when you call CreateDialogParam - so you can give different dialog-procs that way.
But I think this may not be what you mean :wink
When the parent or dialog receives a message (e.g. BN_CLICKED), the 'lParam' of the message gives the handle for who sent it, so you can use that to identify where it came from; also LOWORD(wParam) is the window identifier, so you could use the too. So the parent window doesn't need a different proc for each dialog, just a single one and it can identify the source of the messages.
OK, I will try to use one window procedure.
But during creating dialogs I give them the others windows procedures - different than main window procedure (see post 1).
After clicking on any of dialogs I see that parent window procedure (WndProc) is executing. I dont know how it is possible?