The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: drjr on July 10, 2007, 04:13:34 PM

Title: set caption in al label box
Post by: drjr on July 10, 2007, 04:13:34 PM
The title say all. I do not know how to set a caption (string) to a label box and/or :red a text box in masm32. l(Label boxes and text boxes are used in almost al windows forms).

Realy I want to set the property caption to a static label that I have in a form.
Title: Re: set caption in al label box
Post by: Tedd on July 10, 2007, 04:22:14 PM
Use SetWindowText or WM_SETTEXT ..?


What do you mean by 'label box' ??
Title: Re: set caption in al label box
Post by: ragdog on July 10, 2007, 05:52:12 PM
hi

mean you static- or edit box\field???

setdlgitemtext or sendmessages


greets

ragdog
Title: Re: set caption in al label box
Post by: hutch-- on July 12, 2007, 01:37:06 AM
drjr,

There are multiple methods as both members have explained to you. You need to get a valid window handle to the static control and then either send a message to it or use the API SetWindowText().


    invcoke SendMessage,hWin,WM_SETTEXT,0,ADDR YourText

      or

    invoke SetWindowText,hWin,ADDR YourText


As ragdog suggested you can also use SendDlgItemMessage() where you use the dialog ID instead of the handle.