Mega Code Archive

 
Categories / Delphi / System
 

Unleash the powerful GUI in Windows XP with your Delphi Applications

Title: Unleash the powerful GUI in Windows XP with your Delphi Applications Question: Ok, so this is a question I've been asking myself ever since I saw the first screenshots of WindowsXP All these screenshots show new buttons, scrollbars, checkboxes, edits, listviews and tons more. The questions is, does every application take on this new look when run under WinXP? Well the answer is "no". Microsoft has made a fantastic step with the GUI in WindowsXP, and several changes to the common controls in version 6. This is the library responsible for all of these new fandangled components (controls as Ms calls them). They've designed the shell to be backwards compatible with the older styled look, and by default, that's how everything (regardless of language used) will look. There are a few exceptions however, certain menus, and scrollbars will be drawn in the new style, without any work, but anything else you'll have to work for. There are two ways to accomplish this. Answer: Scenario 1. (Less Reccomended) ====================================================== Download the file at this article's "attacthment URL". Make sure you save the file as "YourAPP.exe.manifest" (change YourAPP to your executeables name if you like, you will eventually need to do this). First you'll want to edit the line with "name=" and change those to your products respective designations, leaving the "."'s in place. Fill in the tag with a brief description of your product. Simply put this file in the same directory of your application. WindowsXP already looks for this file and will see that it's there and BOOM! you're ready to go. If it doesn't work, you've done something wrong. Try again. Scenario 2. (Very Reccomended) ====================================================== The second way to do it is to add it as a resource. This way the file will compile into your application directly and you can maintain a single file distribution (if you're into that sort of thing). To do this follow these steps: Using your favorite text editor, create a file with this in it: 1 24 "YourApp.manifest" Change YourApp to anything you want but NO SPACES! It would make sense to change it to your exe's name (without the .exe!). Save the file as WindowsXP.RES Add the .rc to your project. NOTES FOR NEWBIES - add this line in your main form *usually Form1* DIRECTLY under the line "{$R *.dfm}": {$R WindowsXP.RES} If you have problems with creating the resource file yourself you can download one that will work HERE: http://www.mawst.net/article/WindowsXP.RES Now when you compile your application, the manifest will be included automatically. And you will be dazzled with the new look. NOTE - This technique does NOT currently work in CLX applications! If someone knows a way please e-mail it to me and I will update this article! Now you're ready to go right? WRONG! I HIGHLY recommend you EXTENSIVELY test your application in Windows XP with this enabled. Problems can and DO arise. At the time of writing this, Windows XP isn't even at RC1, so any of this could change without warning! Please don't hold me responsible for any problems you have! You have been warned! And again, please test your application! As for problems, the only thing I've discovered in my (not very extensive) time playing around with this is that using a TListView has some problems. When the control is drawn you may get exceptions, now this is while compiling on XP itself, if you compile on Win2000, or win98 or me, these problems might not present themselves. (NOTE - FIXED IN DELPHI 6?) Just to clarify, you do NOT need to compile your application in XP to get the new look, you do need to be running it in XP though. Thanks for reading, I hope it helps someone out there. Paul Swonger http://www.mawst.net/ mawst@mawst.net