I've written an application in C++ using the pure win32 api (no MFC or WPF). I want the same .exe to run under both Window's XP and Windows Vista / Windows 7.
I was using a manifest to add Visual Styles to the controls in my application. However, when I tested the app on an XP Machine, Buttons do not show up. Only Edit controls and the Menu Bar do.
Edit: I think I forgot to mention this, but the application works fine on WIndows 7/Vista. Edit 2: I'm using the MinGW compiler I thought that this was a problem with the manifest, so I removed it and recompiled my program. But the buttons still don't show up. The manifest that I am using is as follows:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="BlackJack.Viraj"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.2600.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Does the problem lie in the manifest or is it something else?
It's something else. Assuming they are the normal, standard buttons they should show up no matter what the manifest looks like, or whether or not there is one. Something else is going on.
Unless you're using new Windows 7 API, a standard application will go well with both platform. Also Windows 7 has compatibility mode to try out if you find something broken.
Are you sure that you've called InitCommonControls API in the beginning of your program?
See why it's important - http://blogs.msdn.com/b/oldnewthing/archive/2005/07/18/439939.aspx
I'd suggest you to refer a pure Win32 Application http://blogs.msdn.com/b/oldnewthing/archive/2005/04/22/410773.aspx
Also I'd suggest putting the manifest within the Linker options itself in the source file.
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
The manifest is fine. Therefore the problem must be in your code. Creating a themed application isn't quite the same as a non-themed one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.