News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Changing controls texts within dialogs

Started by pavellus, July 05, 2006, 09:35:03 AM

Previous topic - Next topic

pavellus

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.

pavellus

#1
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?

ToutEnMasm


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


ToutEnMasm


Try it !
                     ToutEnMasm

pavellus

Ok, but my question now is:
Why dialogs share the same window procedure from parent window? How to assign them their own procedure?

Tedd

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.
No snowflake in an avalanche feels responsible.

pavellus

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?