The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RHL on February 29, 2012, 12:25:17 AM

Title: How to set and get in a Label control?
Post by: RHL on February 29, 2012, 12:25:17 AM
Hi all, I'm trying to get the characters in a label or write to
one but I have no idea how to do it, I thought of using it
FindWindow> FindWindowEx> sendMessage

this is how you do it?
by the way anyone knows a little tutorial on working with controls?
thanks  :bg
Title: Re: How to set and get in a Label control?
Post by: Gunner on February 29, 2012, 12:46:15 AM
When you create any control with CreateWindowEx, it returns a handle to the created control, save that value.  If  a control is created in a resource, then you can get the handle of the control in the parents WindowProc, usually in WM_INITDIALOG and  do:\
invoke  GetDlgItem, hDlg, CTLID where CTLID is the number you assigned the control in the resource file.

Now to set the text, you send controls messages
invoke   SendMessage, HandleToControl, WM_SETTEXT, 0, offset szStringToDisplay

To get the text of a control
invoke   SendMessage, HandleToControl, WM_GETTEXT, SIZEOFBUFFER, AddressOfBufferToGetString

The are not called labels, they are called static controls  :bg
Title: Re: How to set and get in a Label control?
Post by: RHL on February 29, 2012, 01:15:26 AM
 :clap: :dance: Thanks Gunner, I am making a small app ( my first app) that I think public in the forum :)