Solved

Converting to XP Common Controls

Posted on 2002-05-08
5
205 Views
Last Modified: 2013-12-03
How do I give my app the new XP look but still keep it 100% backwards compatible back to Windows 95?

I believe there is a new COMCTL DLL that needs to be linked to - any info or links to articles on this would be appreciated.

How do I make sure that the app doesn't meltdown if the new DLL is not available (ie for pre-XP versions) ?
0
Comment
Question by:scce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
robpitt earned 100 total points
ID: 6996337
In summary, to enable visual styles you must:
1) Link to comctl32.lib/dll and call InitCommonControls[Ex]()
2) Add a "manifest" (either as a file called "filename.exe.manifest" or better still as a resource ID=1 TYPE=24.

To help you add a manifest heres is my resource template I use with VisualC6
http://www.brightnova.com/downloads/misc/Manifest.rct
save this file to C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Template
Now restart VC6, load a project and choose Insert | Resource... select the item [24]->[1] as the resource type and click New.

This will create a default "manifest.XML" file in your project directory that gets compiled into your EXE. (For some strange reason VC shows it as binary, but its really plain XML text.)

Thats it!




References:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp
0
 

Author Comment

by:scce
ID: 6997560
Thanks Rob.
0
 

Author Comment

by:scce
ID: 6997704
Just tried it and it works a treat - thanks again.

The only thing I've noticed is that it doesn't affect buttons with the BS_ICON style set, these still appear as in Win 95 -> 2K.  Any ideas?
0
 
LVL 5

Expert Comment

by:robpitt
ID: 6998262
Its a known limitation.

For non plain text buttons you need to do much of the drawing yourself using functions like OpenThemeData/DrawThemeEdge etc
E.g.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/CommCtls/Userex/functions/closethemedata.asp

Of course you need to be careful how you link to such functions because they don't exist on anything but WinXP!
0
 

Author Comment

by:scce
ID: 6998352
Thanks rob.  I'll check it out.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question