Solved

Converting to XP Common Controls

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

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 accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
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 …
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

707 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