Thread: Windows XP visual styles

  1. #1
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96

    Windows XP visual styles

    I think this question has been already asked multiple times, but for some reason I couldn't find any related posts so I have to ask. Please just give me a link to a post if the question was asked before.

    My problem with Visual styles (VC++ v.6) is that I can't let them work. (Important notes: 1] I only need to style the Windows controls like buttons and checkboxes, NOT the Common controls, so I'm not going to use ComCtl32.dll v.6 library neither. 2] I need to have the resulting app 100% compatible with older win versions.) I installed the appropriate SDK and began crawling through MSDN. I found articles where they recommend using OpenThemeData() to obtain an HTHEME handle and then owner draw a control using DrawThemeBackground() and similar functions, which is very complicated (I should do this for every control!) and incompatible, because in case Visual styles are not going to be used (e.g. w98), I should owner draw the control by myself too (I can't let system do it in such case, because the control is already owner drawn).

    So my question is: Is there any easier approach to have Visual styles working with basic Windows controls (not Common controls) than the one described in MSDN?
    Last edited by larry; 08-06-2003 at 05:33 PM.
    Please excuse my poor english...

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Last edited by XSquared; 08-06-2003 at 05:50 PM.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96
    Thanks, but this is a description on how to create a manifest file, which I've seen about 50 times. If I just make a manifest file and include it in as a resource, the program doesn't even run. It ends up with an error saying something meaningless like "application is invalid".

    Any clue what's wrong?
    Please excuse my poor english...

  4. #4
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by larry
    Thanks, but this is a description on how to create a manifest file, which I've seen about 50 times. If I just make a manifest file and include it in as a resource, the program doesn't even run. It ends up with an error saying something meaningless like "application is invalid".

    Any clue what's wrong?
    www.cpp-home.com has a tutorial or code on this....not sure if it's manifest or not. Search in both sections.

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Originally posted by larry
    Thanks, but this is a description on how to create a manifest file, which I've seen about 50 times. If I just make a manifest file and include it in as a resource, the program doesn't even run. It ends up with an error saying something meaningless like "application is invalid".

    Any clue what's wrong?
    You add it as custom resource type #24, then rename it to IDR_MANIFEST, and change the value in resource.h?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  6. #6
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96
    You add it as custom resource type #24, then rename it to IDR_MANIFEST, and change the value in resource.h?
    Exactly. Typical Hello World application from VC++ behaves strangely after doing the modification and compiling. It works, but the Help->About menu item doesn't open the About dialog, so I even can't see if Visual styles are enabled. The other application, my bigger project, immediately falls, as I described above.

    P.S. I tried to set IDR_MANIFEST to 1 as on the page you recommended me and to 2 as in MSDN - both with the same results.

    www.cpp-home.com has a tutorial or code on this....not sure if it's manifest or not. Search in both sections.
    I'm unable to find it there! Could you please submit a link?
    Last edited by larry; 08-09-2003 at 01:46 PM.
    Please excuse my poor english...

  7. #7
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by larry
    I'm unable to find it there! Could you please submit a link?
    Did you type in xp?

    [Edit]: It uses XML

  8. #8
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96
    Originally posted by Quantrizi
    Did you type in xp?

    [Edit]: It uses XML
    Aha, I was looking for it in forums. Ok, now I got it. It's a little different recipe than those I've seen, but the result is absolutely the same (first off with the Hello world application).

    What am I doing wrong??
    Last edited by larry; 08-09-2003 at 01:59 PM.
    Please excuse my poor english...

  9. #9
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by larry
    Aha, I was looking for it in forums. Ok, now I got it. It's a little different recipe than those I've seen, but the result is absolutely the same (first off with the Hello world application).

    What am I doing wrong??
    Maybe your version doesn't allow it. Search for CM DiscCleaner (or any other program that has XP styles), and see if it shows. If not, then you got a messed up XP version.

    [Edit]: Did you download the Platform SDK?

  10. #10
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96
    Maybe your version doesn't allow it. Search for CM DiscCleaner (or any other program that has XP styles), and see if it shows. If not, then you got a messed up XP version.
    Every program that uses Visual styles works ok. E.g. ThemeExplorer I downloaded.

    [Edit]: Did you download the Platform SDK?
    No, I'm browsing it online.
    Please excuse my poor english...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  2. Visual C++ .NET 2003 and XP Style
    By kuphryn in forum Windows Programming
    Replies: 1
    Last Post: 10-07-2003, 11:08 AM
  3. Windows XP visual themes and style changing
    By bennyandthejets in forum Windows Programming
    Replies: 15
    Last Post: 10-03-2003, 10:49 AM
  4. Windows XP visual styles in C#?
    By Shag in forum C# Programming
    Replies: 3
    Last Post: 03-26-2003, 06:25 AM
  5. odd errors from msvc std library files
    By blight2c in forum C++ Programming
    Replies: 6
    Last Post: 04-30-2002, 12:06 AM