[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Converting to XP Common Controls

Posted on 2002-05-08
5
Medium Priority
?
215 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
  • 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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Screencast - Getting to Know the Pipeline

834 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