Thread: Simply change the application style theme

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    68

    Simply change the application style theme

    Hello there,
    what is needed to change the controls of a WinAPI application to XP style like Button 1/2 here:
    http://www.codeproject.com/buttonctr...tton/xpbtn.gif

    It would be easy using Visual C++, but I am using DevC++ for win32 applications as Visual C++ creates files 11 times larger than Dev for the same program functions (minimum of 3 times larger).
    Also VC++ creates 10+ files for simple apps and it's file structures of these MFC/win32 apps are way different of mine.

    So I normally use 3 files for all my projects, a .cpp source file for the main code, message loop and callback, a resource header file for declarations of objects and controls (strings, buttons, ..) and a resource script .rc file for properties of the program (window style, menu, controls, ..).

    Functions of the menubar items or controls are being processed in the callback with case WM_COMMAND in my programs other than in VC++ created apps.

    Well, I couldn't find any help on msdn/google after 2 hours of searching. I only got examples using classes and weird code, but I want to know where my program does what and when.. so classes are useless for me.
    So, how can I change the style of my controls to XP or ComCtl32 without classes and crap?

    Maybe I am totally talking ****. Tell me if so
    Thanks for any help.

    Hawk

  2. #2
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    You'll need to use a manifest file.
    http://msdn.microsoft.com/library/de.../xptheming.asp

    MSDN is just wonderful.

    I get much smalle executable sizes with Visual C++ 2005. The project folder size is, yes, a lot bigger. But the executable itself is what matters the most. Visual Studio creates other files (like IntelliSense database file to provide help while programming) to keep settings. Because the settings may be different per project.
    Last edited by mrafcho001; 08-25-2006 at 03:13 PM.
    My Website
    010000110010101100101011
    Add Color To Your Code!

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    68
    Thanks! You've pointed me in the right direction.
    But I still can't get it to work.

    I've done version 2 on the page,
    Code:
    Using ComCtl32 Version 6 in an Application That Uses Extensions, Plugins, or a DLL That is Brought into a Process
    So I included the header file and the define, then created a .manifest file with the data.
    Afterwards I added the manifest to my .rc file with:
    Code:
    CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "app.manifest"
    "Winuser.rh" doesn't exist, only Winuser.h and it contains
    Code:
    #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
    and
    Code:
    #define RT_MANIFEST 24
    but not
    Code:
    #define CONTROL_PANEL_RESOURCE_ID 123
    Well, if I compile and link the project (with Dev C++) with and without the missing define no error occurs and everything's fine, but the program won't start afterwards and if I start it from the folder I get an error telling me it can't be started as the application configuration isn't correct.
    ... I didn't do anything wrong I believe.

    And about the filesize... I only have VC++ 6.0 and with removing all optional linking/compiling options I get a minimum filesize of 52 kB. With Dev C++ it's 15 kB with normal options.

    Edit: The CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "app.manifest" command is causing this problem...

    Edit2: Wow thank you very much! I solved the problem - several info in the manifest was needed as I really need to identify my app with the "version", "name" and description tags.
    Last edited by Hawkin; 08-25-2006 at 06:44 PM.

  4. #4
    ... arjunajay's Avatar
    Join Date
    May 2005
    Posts
    203
    Some times I have to include the header commctrl.h and in the begining of winmain add InitCommonControls(); for my app to start. But I'm not an expert in this subject.
    P.S. Sure your manifest is correct ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is it possible to change the board Theme?
    By RealTime in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 10-11-2008, 02:48 PM
  2. How to change window style at runtime?
    By Mr. Bitmap in forum Windows Programming
    Replies: 5
    Last Post: 06-09-2002, 04:49 PM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  4. how to line change in a console application
    By new2c++ in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2002, 09:20 PM
  5. Replies: 2
    Last Post: 09-04-2001, 02:12 PM