Delphi 7 vista / windows 7 manifest

前端 未结 4 1393
萌比男神i
萌比男神i 2020-12-12 20:15

Would anyone have an example of a manifest file for Delphi 7 which allows apps to run as administrator on Windows XP / Vista / 7?

Running an application with this fe

4条回答
  •  囚心锁ツ
    2020-12-12 20:32

    Here are the steps:

    1. Remove XPMan: Remove any reference to XPMan component in your project. XPMan adds a default manifest to the executable that prevents Windows to see our customized manifest. You shouldn't be worried about XP Theme provided by XPMan, theme support is preserved in the following manifest.

    2. Create the customized manifest: Create a file like Win7UAC.manifest in the project directory (the filename really doesn't matter). add the following lines to Win7UAC.manifest:

    
    
      
      
        
          
        
      
      
        
          
            
            
        
      
      
        
          
          
          
          
        
      
    
    

    You can add more items to this manifest. You can also remove Microsoft.Windows.Common-Controls parts to disable the theme support.

    3. Compile manifest to a resource: Create a file named Win7UAC.rc in the project directory that contains one line as:

    1 24 "Win7UAC.manifest"
    

    To compile this file, go to cmd, point to project directory and run following command:

    brcc32.exe Win7UAC.rc
    

    4. Add resource (the manifest) to the project: Just add the following line anywhere you want in one of the unit files of the project:

    {$R 'Win7UAC.res'}
    

    A suitable place for adding this line is in the project main file (usually named Project1.dpr) and under the {$R *.res} line.

    5. Rebuild the project

    6. Remember whenever you add XPMan component to any of project units, this UAC manifest will not work properly.

提交回复
热议问题