elevate to admin in Vista

Not tried this but you should be able to compile a valid manifest (like the one in the linked article) to a .res file with the rc.exe utility. You would need to generate a .rc file that refers to the manifest.

Firstly create a file call <something>.rc
Code:
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST                     24

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "<whatever the manifest is called>.manifest"
Then compile it with the following command line
Code:
RC.EXE /r /fo <resource file name>.res <something>.rc

You can then add the resulting .res file to you VB6 project. Haven't tried it (no VB6 handy) but I've used a similar trick in the past to build custom resource files for VB6 and it has worked fine....
 
Hi again :)
Many thanks for your help, yes I am familiar with the rest of process, but because I have to enable visual styles also, I got a problem, here is my manifest file:
Code:
<?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="company.file.exe"
     type="win32"/>

  <description>My Software.</description>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity processorArchitecture="X86"
          name="Microsoft.Windows.Common-Controls"
          type="win32"
          language="*"
          publicKeyToken="6595b64144ccf1df"/>
    </dependentAssembly>
  </dependency>

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>
And here is my rc file:
Code:
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST                     24
#define CONTROL_PANEL_RESOURCE_ID       123

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST             "file.exe.manifest"
But after compile and run I got this error:

The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail.

It was working correctly when I was only enabling visual styles, but not now, I think the problem is from manifest!
 
Back
Top