C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 05-28-2009, 06:34 AM   #1
Registered User
 
Cha0sBG's Avatar
 
Join Date: May 2009
Posts: 7
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 ?
Cha0sBG is offline   Reply With Quote
Old 05-28-2009, 06:44 AM   #2
Registered User
 
Codeplug's Avatar
 
Join Date: Mar 2003
Posts: 3,844
>> " \ "
I would remove that line continuation and make it one continuous string literal.

gg
Codeplug is offline   Reply With Quote
Old 05-28-2009, 06:52 AM   #3
Registered User
 
Cha0sBG's Avatar
 
Join Date: May 2009
Posts: 7
Well bro ... that's the code i saw @ msdn library

here is the link: Enabling Visual Styles
Cha0sBG is offline   Reply With Quote
Old 05-28-2009, 07:51 AM   #4
Registered User
 
Codeplug's Avatar
 
Join Date: Mar 2003
Posts: 3,844
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
Codeplug is offline   Reply With Quote
Old 05-28-2009, 07:55 AM   #5
Afraid of widths
 
medievalelks's Avatar
 
Join Date: Apr 2008
Location: Chicago
Posts: 887
Quote:
Originally Posted by Cha0sBG View Post
Any suggestions ?
Use wxWidgets instead.
medievalelks is offline   Reply With Quote
Old 05-28-2009, 09:29 AM   #6
Registered User
 
Cha0sBG's Avatar
 
Join Date: May 2009
Posts: 7
@Codeplug:
with your code it compiled but all my controls desapeared -.-
Cha0sBG is offline   Reply With Quote
Old 06-05-2009, 01:54 AM   #7
train spotter
 
Join Date: Aug 2001
Location: near a computer
Posts: 3,359
Quote:
Originally Posted by Cha0sBG View Post
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.
__________________
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche

"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best

"If you are going through hell....keep going."
Winston Churchill
novacain is offline   Reply With Quote
Old 06-05-2009, 04:35 PM   #8
int x = *((int *) NULL);
 
Cactus_Hugger's Avatar
 
Join Date: Jul 2003
Location: Banks of the River Styx
Posts: 891
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.)
__________________
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
Cactus_Hugger is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for free win32 gui (resource) editor umen242 Windows Programming 1 05-22-2008 03:49 AM
Limitations on Win32 API functions csonx_p Windows Programming 5 04-09-2008 04:09 AM
Win32 API help 52Cent Windows Programming 8 01-23-2008 10:24 AM
Win32 API and MFC loopshot C++ Programming 6 12-07-2004 11:58 AM
Win32 API Liger86 Windows Programming 2 01-30-2003 02:19 PM


All times are GMT -6. The time now is 11:34 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22