CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Binding Data to Silverlight 4.0 Controls Using ASP.NET MVC Framework 2.0
  • ADO.NET Data Services in the .NET Framework
  • Visual C++ Programming: What's new for MFC library in VC++ 2010?
  • Microsoft Visual Studio LightSwitch and What It Can Do For You

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old March 31st, 2009, 11:22 PM
    BakenBowl BakenBowl is offline
    Junior Member
     
    Join Date: Mar 2009
    Posts: 4
    BakenBowl is an unknown quantity at this point (<10)
    Question How to use visual style controls in VC++ 6.0 IDE and in MFC applications.

    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:
    Attached Files
    File Type: txt AppName.exe.manifest.txt (596 Bytes, 31 views)

    Last edited by BakenBowl; April 1st, 2009 at 01:16 AM.
    Reply With Quote
      #2    
    Old April 1st, 2009, 01:55 AM
    fantasy1215 fantasy1215 is offline
    Member
     
    Join Date: Jan 2008
    Posts: 92
    fantasy1215 is an unknown quantity at this point (<10)
    Re: How to use visual style controls in VC++ 6.0 IDE and in MFC applications.

    Quote:
    1. Create a new text File in the applications working directory(place it with your Program.exe in the same 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>
    If your application is not applied visual style yet, with these 2 steps, when you double click to run your Program.exe, it would apply visual style.
    Reply With Quote
      #3    
    Old April 1st, 2009, 02:10 AM
    Skizmo's Avatar
    Skizmo Skizmo is offline
    Elite Member
     
    Join Date: Sep 2004
    Location: Holland (land of the dope)
    Posts: 3,334
    Skizmo is a name known to all (1000+)Skizmo is a name known to all (1000+)Skizmo is a name known to all (1000+)Skizmo is a name known to all (1000+)Skizmo is a name known to all (1000+)Skizmo is a name known to all (1000+)Skizmo is a name known to all (1000+)Skizmo is a name known to all (1000+)Skizmo is a name known to all (1000+)
    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 ?
    Reply With Quote
      #4    
    Old April 1st, 2009, 11:43 AM
    BakenBowl BakenBowl is offline
    Junior Member
     
    Join Date: Mar 2009
    Posts: 4
    BakenBowl is an unknown quantity at this point (<10)
    Re: How to use visual style controls in VC++ 6.0 IDE and in MFC applications.

    Quote:
    Originally Posted by fantasy1215
    If your application is not applied visual style yet, with these 2 steps, when you double click to run your Program.exe, it would apply visual style.

    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:
    Originally Posted by Skizmo
    Do you have a question for us, or are you just dumping some code over here ?
    No question, I use this site a lot and I thought i could contribute something.

    Last edited by BakenBowl; April 1st, 2009 at 11:47 AM.
    Reply With Quote
    Reply

    Bookmarks

    Tags
    vista style, visual controls, visual styles, xp controls, xp style
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 09:03 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.