Hello. I have trouble when using "Support WinXP styles". My pushbutton and other controls don't show up at all. I have read some of the 2600 threats about this, but couldn't find an answer. I know it's something with the manifest file, but what? Project's _private.rc file shows that it IS included. What do I then have to do with it? I can't guess it because I don't know what a manifest is, don't know what it does and don't like the fact of including so much generated textual files in my program at all. Anyone know this by heart?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there another manifest file included in the resource file? Do the buttons show OK without the manifest file? You don't have to do anything with it except include it in the resources. The standard file generated by dev-cpp shouldn't have that kind of effect.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yup, the WinXP styles option brings down almost every program, including the examples distributed with dev. No more msgbox, common dialog, pushbutton or whatever.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've used XP style with some of my apps, but I supplied my own manifest file instead of using the Dev option. Here's a copy of it.. hopefully the forum won't muck it up too much
Then I have this line in my resource.h file, and comment it out if I want to turn XP style off.
define XP_MANIFEST
Try that and let us know if it works, if not then there's something else at work.. perhaps something in the way the buttons are created or common controls initialized.
b_a
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would enjoy linking comctl, but I ain't using any of the common controls. Only a standard button, as follows:
hBtn = CreateWindow("button", "Don't click me", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 20, 20, 100, 100, hwnd, NULL, NULL);
But I will try it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
/ Make the class name into a global variable /
char szClassName[ ] = "WindowsApp";
HANDLE hBtn;
HINSTANCE _hInst;
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; / This is the handle for our window /
MSG messages; / Here messages to the application are saved /
WNDCLASSEX wincl; / Data structure for the windowclass /
/* The Window structure */
wincl.hInstance=hThisInstance;
wincl.lpszClassName=szClassName;
wincl.lpfnWndProc=WindowProcedure;/* This function is called by windows */
wincl.style=CS_DBLCLKS;/* Catch double-clicks */
wincl.cbSize=sizeof(WNDCLASSEX);/* Use default icon and mouse-pointer */
wincl.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wincl.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
wincl.hCursor=LoadCursor(NULL,IDC_ARROW);
wincl.lpszMenuName=NULL;/* No menu */
wincl.cbClsExtra=0;/* No extra bytes after the window class */
wincl.cbWndExtra=0;/* structure or the window instance *//* Use Windows's default color as the background of the window */
wincl.hbrBackground=(HBRUSH)COLOR_BACKGROUND;/* Register the window class, and if it fails quit the program */if(!RegisterClassEx(&wincl))return0;/* The class is registered, let's create the program*/
hwnd=CreateWindowEx(0,/* Extended possibilites for variation */szClassName,/* Classname */"WindowsApp",/* Title Text */WS_OVERLAPPEDWINDOW,/* default window */CW_USEDEFAULT,/* Windows decides the position */CW_USEDEFAULT,/* where the window ends up on the screen */544,/* The programs width */375,/* and height in pixels */HWND_DESKTOP,/* The window is a child-window to desktop */NULL,/* No menu */hThisInstance,/* Program Instance handler */NULL/* No Window Creation data */);/* Make the window visible on the screen */
_hInst=hThisInstance;
ShowWindow(hwnd,nFunsterStil);/* Run the message loop. It will run until GetMessage() returns 0 */while(GetMessage(&messages,NULL,0,0)){/* Translate virtual-key messages into character messages */TranslateMessage(&messages);/* Send message to WindowProcedure */DispatchMessage(&messages);}/* The program return-value is 0 - The value that PostQuitMessage() gave */returnmessages.wParam;
}
/ This function is called by the Windows function DispatchMessage() /
break;
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now I opened an other test project, similar to this, with the xp option unchecked. I checked it, pressed F9 and there I got my XP look.
(ok, the down button of the UpDown control looked a bit strange, and the Up button makes the value of the buddy decrease, but ok. This project uses commctrl with InitCommonControls() in the WinMain. I don't know if that makes a difference, but my pushbutton looked right as well.
Oh and even though I linked -lcomctl32, the compiler didn't recognize INITCOMMONCONTROLSEX structure, so I decided to use InitCommonControls(). Don't know if that matters)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If the app I posted doesn't work I think it's not a problem with dev. You should be able to compile a program without support xp themes enabled, and then add a manifest in the same directory and it should change to xp theme.
Here's something you can try with the code I posted, make a new folder, and start a new project in it with that code, compile without themes, and run.. you should get a window with a plain button.
Now take the manifest code I posted earlier and paste it into notepad, then save it in the folder with the name "myapp.exe.manifest" except put the name you used for the exe file instead of "myapp"
Run the exe file and it should have an xp style button. If it doesn't I would say the problem is in your OS.
I've taken old apps I compiled under win95 with RapidQ (an old BASIC type language), put them on my XP machine, added that manifest file in the directory with them and got the xp styles, shouldn't have anything to do with the compiler. I've also done this on 3 different machines running XP, both SP1 and SP2, don't recall having a problem with buttons not showing up.
I'm really interested to find out what's causing this.. tough one...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello. I have trouble when using "Support WinXP styles". My pushbutton and other controls don't show up at all. I have read some of the 2600 threats about this, but couldn't find an answer. I know it's something with the manifest file, but what? Project's _private.rc file shows that it IS included. What do I then have to do with it? I can't guess it because I don't know what a manifest is, don't know what it does and don't like the fact of including so much generated textual files in my program at all. Anyone know this by heart?
Sorry for bringing up such an old thread, but this may be important for answering questions: this
http://sourceforge.net/forum/message.php?msg_id=3689118 turns out to be the same problm.
Is there another manifest file included in the resource file? Do the buttons show OK without the manifest file? You don't have to do anything with it except include it in the resources. The standard file generated by dev-cpp shouldn't have that kind of effect.
Only if I uncheck the WinXP styles option and delete the _private and the manifest, my controls will be there again, but no XP look...
Dev-Cpp 4.9.9.0
WinXP
Yup, the WinXP styles option brings down almost every program, including the examples distributed with dev. No more msgbox, common dialog, pushbutton or whatever.
I've used XP style with some of my apps, but I supplied my own manifest file instead of using the Dev option. Here's a copy of it.. hopefully the forum won't muck it up too much
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly
xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
processorArchitecture="x86"
version="5.1.0.0"
type="win32"
name="app.exe"/>
<description>Foo program</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="x86"/>
</dependentAssembly>
</dependency>
</assembly>
I put this in my resource script:
ifdef XP_MANIFEST
1 24 "winxp.manifest"
endif
Then I have this line in my resource.h file, and comment it out if I want to turn XP style off.
define XP_MANIFEST
Try that and let us know if it works, if not then there's something else at work.. perhaps something in the way the buttons are created or common controls initialized.
b_a
Ah.. not mucked up except for indentation.. good
I should have mentioned that you should save that manifest in a file named winxp.manifest and put it in the directory with your project.
b_a
Thanx man. I will let ya know if it works.
Unfortunately it doesn't make any difference. My controls still don't show up,
GetLastError() still returns 583...
I think technically you're supposed to change "app.exe" in that to the name of your program, but I didn't and it worked.
Have you tried linking with -lcomctl32 and calling InitCommonControlsEx?
There may also be some issue with the style of buttons, are you using flat buttons?
Perhaps you could post some example code.
b_a
I would enjoy linking comctl, but I ain't using any of the common controls. Only a standard button, as follows:
hBtn = CreateWindow("button", "Don't click me", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 20, 20, 100, 100, hwnd, NULL, NULL);
But I will try it.
MSDN says that 583 means ERROR_UNDEFINED_CHARACTER.
Isn't that a bit strange? I'm not using unicode and am almost sure it's not such kind of proble,.
Would an install of 4.9.9.2 instead of 4.9.9.0 help?
I meant:
hBtn = CreateWindow("button", "Don't click me", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 20, 20, 100, 100, hwnd, NULL, _hInst, NULL);
Ok, stupid question time.. since you've given us so little information I have to ask.... are you actually running Windows XP?????
Ok... nevermind.. I looked again and it's there, didn't see it the first time.
Well.. try this code, I took your button line and added it to the stock Dev windows app, turned on support xp themes and it works okay here.
include <windows.h>
/ Declare Windows procedure /
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/ Make the class name into a global variable /
char szClassName[ ] = "WindowsApp";
HANDLE hBtn;
HINSTANCE _hInst;
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; / This is the handle for our window /
MSG messages; / Here messages to the application are saved /
WNDCLASSEX wincl; / Data structure for the windowclass /
}
/ This function is called by the Windows function DispatchMessage() /
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) / handle the messages /
{
case WM_CREATE:
hBtn = CreateWindow("button", "Don't click me",
WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 20, 20, 100, 100,
hwnd, NULL, _hInst, NULL);
}
btw: running WinXP SP2 and dev 4.9.9.2
Mysteriously, it doesn't work okay here. GetLastError returns 583.
Now I opened an other test project, similar to this, with the xp option unchecked. I checked it, pressed F9 and there I got my XP look.
(ok, the down button of the UpDown control looked a bit strange, and the Up button makes the value of the buddy decrease, but ok. This project uses commctrl with InitCommonControls() in the WinMain. I don't know if that makes a difference, but my pushbutton looked right as well.
Oh and even though I linked -lcomctl32, the compiler didn't recognize INITCOMMONCONTROLSEX structure, so I decided to use InitCommonControls(). Don't know if that matters)
Oh sorry, 583 - that should be 183.
My fault. I had converted a DWORD to a string by calling ltoa(), I didn't know how to do that.
ERROR_ALREADY_EXISTS? That must also be a mistake.
It's exactly the same probem as in this threat:
http://sourceforge.net/forum/message.php?msg_id=2285662
Sometimes it works but most of the time it doesn't, and with mysterious reasons.
And this one:
http://sourceforge.net/forum/message.php?msg_id=2335184
There are hundreds of threads about this problem, but none of them seems to have their problem solved. What is this kinda mystery?
About InitCommonControlsEx, see this thread, and the thread it has a link to.
http://sourceforge.net/forum/message.php?msg_id=2486139
If the app I posted doesn't work I think it's not a problem with dev. You should be able to compile a program without support xp themes enabled, and then add a manifest in the same directory and it should change to xp theme.
Here's something you can try with the code I posted, make a new folder, and start a new project in it with that code, compile without themes, and run.. you should get a window with a plain button.
Now take the manifest code I posted earlier and paste it into notepad, then save it in the folder with the name "myapp.exe.manifest" except put the name you used for the exe file instead of "myapp"
Run the exe file and it should have an xp style button. If it doesn't I would say the problem is in your OS.
I've taken old apps I compiled under win95 with RapidQ (an old BASIC type language), put them on my XP machine, added that manifest file in the directory with them and got the xp styles, shouldn't have anything to do with the compiler. I've also done this on 3 different machines running XP, both SP1 and SP2, don't recall having a problem with buttons not showing up.
I'm really interested to find out what's causing this.. tough one...
Thanks for the _WIN32_IE 0x0600 tip.
Almost the same one as WINVER 0x0500 for TransparentBlt().