Solved

Converting to XP Common Controls

Posted on 2002-05-08
5
200 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 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now