?
Solved

Converting to XP Common Controls

Posted on 2002-05-08
5
Medium Priority
?
208 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 400 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

800 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