News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

About LText

Started by Eric4ever, March 15, 2006, 08:42:39 AM

Previous topic - Next topic

Eric4ever

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.. :(

PBrennick

Eric4ever,
A static control is readonly at run time.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Eric4ever

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?

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php