Dialog as main control question

Started by rags, March 18, 2005, 06:01:21 PM

Previous topic - Next topic

rags

Working with radasm, I created a dialog as main project.
On the dialog I have an edit control and three buttons.
I have given the name IDC_EDT1 to the edit box, and the names
IDC_TRIM          
IDC_CLEAR          
IDC_CLOSE          
to the buttons, with these equates in the .inc file:

IDC_EDT1 equ 1001
IDC_TRIM equ 1002
IDC_CLEAR equ 1003
IDC_CLOSE equ 1004


My problem is, that when I invoke the SetWindowText function, in the WndProc such as:

.elseif eax == IDC_CLEAR
invoke MessageBox,hWnd,SADD("clear button pressed"),SADD("hi"),MB_OK
invoke SetWindowText,IDC_EDT1,NULL

to clear the text in the edit box, the messagebox appears, but nothing happens to the text
in the edit control.
Am I wrong to assume IDC_EDT1 is the hande of the edit control on the dialog?


regards
God made Man, but the monkey applied the glue -DEVO

AeroASM

You need to use SetDlgItemText.

SetWindowText requires a window handle, which you do not have (you only have a control identifier). To get the window handle of a child control of a dialog box, you can use GetDlgItem, and then you can call SetWindowText. But SetDlgItemText does both these in one call.

rags

AeroAsm,
  Thanks for the clarification on the window handle/control ID.
God made Man, but the monkey applied the glue -DEVO