-
Win32 API GUI problems
i got a problem on my hands:
When i create a button with the following code:
Code:
hButton1 = CreateWindowEx(WS_EX_STATICEDGE, "Button", "Close", WS_CHILDWINDOW | BS_PUSHBUTTON
| WS_VISIBLE, 130, 185, 50, 20, hwnd, NULL, hInstance, NULL);
It uses the Windows XP Classic style.
Trying to make it to Default op system skin with the following code:
Code:
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' " \ "version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
But it generates the following error :
Code:
Error 1 error C2017: illegal escape sequence d:\c++ projects\phoenixloader\phoenixloader\mainapi.cpp 14
Any suggestions ?
-
>> " \ "
I would remove that line continuation and make it one continuous string literal.
gg
-
Well bro ... that's the code i saw @ msdn library :(
here is the link: Enabling Visual Styles
-
If you would have actually tried what I suggested, you would have found your issue solved.
Code:
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
//or
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
//or
#pragma comment(linker, \
"/manifestdependency:\"" \
"type='win32' " \
"name='Microsoft.Windows.Common-Controls' " \
"version='6.0.0.0' " \
"processorArchitecture='*' " \
"publicKeyToken='6595b64144ccf1df' " \
"language='*'\"")
gg
-
Quote:
Originally Posted by
Cha0sBG
Any suggestions ?
Use wxWidgets instead.
-
@Codeplug:
with your code it compiled but all my controls desapeared -.-
-
Quote:
Originally Posted by
Cha0sBG
Code:
hButton1 = CreateWindowEx(WS_EX_STATICEDGE, "Button", "Close", WS_CHILDWINDOW | BS_PUSHBUTTON
| WS_VISIBLE, 130, 185, 50, 20, hwnd, NULL, hInstance, NULL);
CreateWindowEx's hMenu param should contain the controls ID number (if you use the WS_CHILD style), you have set it to zero.
If this is a common mistake yo have made with all controls you create it may be the cause.
The controls ID must be unique (on a dlg basis) or they may not function correctly (like having the style applied to them).
Depends on how a the control is called/identified by each msg handler (HWND or ID) as to which functionality works and which fails.
-
Controls disappearing sounds like the usual behaviour of forgetting to call InitCommonControls or InitCommonControlsEx. Have you called one of those functions? (The MSND page you link to additionally notes that you must call InitCommonControls(Ex) to enable visual styles.)