for example,the RC file is below:
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.. :(
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.. :(
You can do like this:
- Use EnumChildWindows
- For each child window do a check for classname(GetClassName) to see if it equals "STATIC".
Then check if the window's text is "Text"(GetWindowText) and check if the child window's ID is 0FFFFh(GetDlgCtrlID).
Then you may change the window's text to the one you like(SetWindowText).
You can do like this:
- Use EnumChildWindows
- For each child window do a check for classname(GetClassName) to see if it equals "STATIC".
Then check if the window's text is "Text"(GetWindowText) and check if the child window's ID is 0FFFFh(GetDlgCtrlID).
Then you may change the window's text to the one you like(SetWindowText).
I made it!
Thanks k3Eahn