Click here to Skip to main content
15,881,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Have a VC6 application. I want to set "Manifest Execution Level" to "RequireAdministrator" but Visual 6 does not have this option.
what should I do to run my MyApplication.exe and pop up "User Account Control" Message???
Posted

You can manually create a manifest file with a text editor. It would contain:
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="RequireAdministrator"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>

If you save it in the same directory as your application, you should get the desired result.

The manifest file you save must be named with your application name and .manifest. For instance, if your application is called "MyApp.exe" then the manifest file would be MyApp.exe.manifest.

Another option is to simply name your application with a name containing one of the "triggers" for UAC. Admin UAC is automatically triggered if the app name includes "setup", "install" or several other similar words.

Hope that helps.
 
Share this answer
 
v2
Comments
Alain Rist 18-Nov-10 1:54am    
From OP: Tank you but I wrote the code and named it like you said but it does not work. can you tell me why??
Minoo Khazeni 18-Nov-10 4:45am    
it worked
Tanks aloooooooooooooooooooot
The real answer is: upgrade your app to VS2010 or VC2010 Express :)

If, for any good reason, you cannot, download the Windows 7 SDK[^] and try use the manifest tool[^] from the command line.

Good luck :)
AR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900