| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
To use visual style controls in MFC app:
Without Visual Style: ![]() With Visual Style: ![]() 1. Create a new text File in the applications working directory and name it AppName.exe.manifest (where "AppName" is the apps exe file name). For example, if my programs executable file is named "Program.exe" I would name the Manifest file "Program.exe.manifest". 2. place these lines in the newly created manifest file: <?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="X86" name="OnlineText" type="win32" /> <description>Styles - demonstrate XP styles</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> (You can replace version and name with your apps name and version, but it is not necessary.) 3. add these lines to the bottom of Resources.h: #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 #define CONTROL_PANEL_RESOURCE_ID 123 #define RT_MANIFEST 24 4. Go to your ResourceView tab in the workspace. RightClick on the most parent folder(ends with "Resources") and click Resource Includes. A dialog will pop up. Put this line at the bottom of the "Compile-Time Directives" box: CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "AppName.exe.manifest" (again, AppName should be the name of your executable file) Then click ok. 5. Compile your app, make sure the resources file is recompiled also(Resource file should automatically be recompiled when you compile your program). Thats it, your app should now have a visual style. To Make the VC++ 6.0 IDE Development Enviorment use visual styles: 1. Create a new text File in "C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\", or wherever MSDev98 is located. Name it "MSDev98.exe.manifest". 2. place these lines in the newly created manifest file: <?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="X86" name="OnlineText" type="win32" /> <description>Styles - demonstrate XP styles</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> 2. That's it, VC++ 6.0 should now use XP or Vista visual styles. This is helpful when designing forms so you can see the end result. You can also use this technique for Visual Basic or virtually any other program that you would like, even vb apps(see: VB 6.0 using visual styles) just make sure to name the manifest file right. VC++ 6.0 environment using visual styles: ![]() VB 6.0 using visual styles:
Last edited by BakenBowl; April 1st, 2009 at 01:16 AM. |
|
#2
|
|||
|
|||
|
Re: How to use visual style controls in VC++ 6.0 IDE and in MFC applications.
Quote:
|
|
#3
|
||||
|
||||
|
Re: How to use visual style controls in VC++ 6.0 IDE and in MFC applications.
Do you have a question for us, or are you just dumping some code over here ?
|
|
#4
|
|||
|
|||
|
Re: How to use visual style controls in VC++ 6.0 IDE and in MFC applications.
Quote:
Yes, this is true but the other steps put the manifest in the programs resource file. This makes it so you don't have to have a separate file for the manifest yet it is built in with the exe. Quote:
Last edited by BakenBowl; April 1st, 2009 at 11:47 AM. |
![]() |
| Bookmarks |
| Tags |
| vista style, visual controls, visual styles, xp controls, xp style |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|