• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1269
  • Last Modified:

D7: Disable XP manifest (XPman) support at run-time

Hi Experts,

Under WinXP I use XP manifest to enable fancy buttons and borders on TEdit/ TListView/.. in my program. So I just add to the uses clause (uses ...XPman;) Unfortunately, it comes with a pice: there are several known comctl32.dll - related bugs that come with using XPman.pas For example: scroll bars style = flat does not work any more (they are either blue or standard gray bricks).
 
If running my program on Win2K machine I don't need XPman any more (and all problems that come with it) , and I recompile my program without <uses ..XPman>. This leaves me with 2 version of same programm for WinXP and Win2K OS's which is sad.

Q. Is there any way to get rid of XPman support in a run-time (say, if running on Win2K machine)?

Sincerely,
odissey1
0
odissey1
Asked:
odissey1
  • 3
  • 2
1 Solution
 
RobnCommented:
Win2K doesn't load the manifest file and it doesn't come with the themed controls like WinXP does.
If you want to be able to turn off this support in WinXP, stop using XPMan and create your own manifest file. This file is XML and if you name it the same name as your executable, WinXP will load the manifest. If you experience a lot of problems in your application because of this, remove the file from the folder or rename it and Windows will not theme the controls when your application starts again.

The file should be named myapp.exe.manifest

Here are the contents (you can tweak these values to better suit your application.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
   version="1.0.0.0"
   processorArchitecture="X86"
   name="Microsoft.VB6.VBnetStyles"
   type="win32"
/>
<description>myapp</description>
<dependency>
   <dependentAssembly>
     <assemblyIdentity
       type="win32"
       name="Microsoft.Windows.Common-Controls"
       version="6.0.0.0"
       processorArchitecture="X86"
       publicKeyToken="6595b64144ccf1df"
       language="*"
     />
   </dependentAssembly>
</dependency>
</assembly>

Hope this helps,
Rob
0
 
odissey1Author Commented:
Hi Rob,

Thank you for comment and suggestion. I need some time to experiment with it.
My concern with your approch is the same like using <uses ...XPman>. Supposedly, XP manifest does not do anything in Win2k. Unfortunately, this is not the case. If XPman is present (anywhere) in the program running in Win2k, it does affect general outlook. It should not, but it does  - this is comctl32.dll bug.

Example: put a ListView on a form and set scrool bar style  to Flat, run it on Win2k -- scroll bar is flat. Now add <uses ...XPman> and run it again -- scroll bar is 3D brick. And this is just very innocent bug, others are much worse.

Maybe there are some other approaches to my problem?
My problem is that my application works fine both in Win2K and WinXP without <uses ..XPman>. Of course, all controls are pained standard windows gray-brick style. It would be nice to enable somehow fancy buttons/combos etc. if application was started in WinXP. But how to do this?  

Sincerely,
Boris
P.S. I am adding extra 50 points since the question seems to be tough.
0
 
RobnCommented:
My approach is different because XPMan links the resource into the application. My solution allows you to remove this file from the folder if you are having problems with the application or you want to install it to an OS other than XP. You could have your install script test for XP and if it is, then copy the manifest file into the folder.

Regards,
Rob
0
 
odissey1Author Commented:
Hi Rob,

Thank you for help. Since there are no any other comments on the subject I consider this is the way to go.

Sincerely,
Boris
0
 
RobnCommented:
Glad I could help
Regards,
Rob
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now