The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Eric4ever on March 15, 2006, 08:42:39 AM

Title: About LText
Post by: Eric4ever on March 15, 2006, 08:42:39 AM
for example,the RC file is below:
DLG_MAIN DIALOGEX 100,100,320,240
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CENTER
EXSTYLE WS_EX_CLIENTEDGE
CAPTION "Just Testing"
MENU IDM_EN
FONT 9, "MS Sans Serif"
BEGIN
   PUSHBUTTON      "English",IDC_Button,116,111,72,16
   LTEXT      "Text",-1,78,39,168,42
END


How can I change the contents of the LTEXT which ID is Static(-1)?
I tried to set the ID of LTEXT, but when I LoadString(in the STRINGTABLE) and SetDlgItemText, it failed.. :(
Title: Re: About LText
Post by: PBrennick on March 15, 2006, 07:42:51 PM
Eric4ever,
A static control is readonly at run time.

Paul
Title: Re: About LText
Post by: Eric4ever on March 16, 2006, 02:43:51 AM
Quote from: PBrennick on March 15, 2006, 07:42:51 PM
Eric4ever,
A static control is readonly at run time.

Paul


I made it!
LTEXT           "Text",IDC_TEXT,78,39,168,42
and  I LoadString(in the STRINGTABLE) and SetDlgItemText.

But there is another problem :(, I succeed in writing a test multilanguage program which has menu/button/text in the main dialog, but I failed when I transplant it to my program in oder to make it language optional(English & Chinese), the program has menu/button/text/tooltip and email HyperLink in the about dialog, I checked it but found nothing different between the program and the test program...
Do I miss something?
Title: Re: About LText
Post by: hutch-- on March 16, 2006, 02:56:14 AM
Eric,

2 things, you can change the ID in the RC file to anything you like as long as it unique. Normally you can change the text within a static control with SetWindowText() or the message WM_SETTEXT sent with Sendmessage() as long as you obtain a valid handle for the static control.

Just use this API,


HWND GetDlgItem(
    HWND hDlg, // handle of dialog box
    int nIDDlgItem // identifier of control


to get the handle of the static control and you can set whatever text you like in it.