The MASM Forum Archive 2004 to 2012

Project Support Forums => IDE Development and Support => RadAsm Support Forum => Topic started by: rags on March 18, 2005, 06:01:21 PM

Title: Dialog as main control question
Post by: rags on March 18, 2005, 06:01:21 PM
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
Title: Re: Dialog as main control question
Post by: AeroASM on March 18, 2005, 09:45:41 PM
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.
Title: Re: Dialog as main control question
Post by: rags on March 19, 2005, 01:35:28 PM
AeroAsm,
  Thanks for the clarification on the window handle/control ID.