How to enable UAC prompt through programming

Posted by peter on Stack Overflow See other posts from Stack Overflow or by peter
Published on 2010-06-10T08:29:07Z Indexed on 2010/06/10 8:32 UTC
Read the original article Hit count: 292

I want to implement a UAC prompt for an application in visualc++ the operating system is 32bit x7460(2processor) Windowsserver 2008 the exe is myproject.exe through manifest..

Here for testing i wl build the application in Windows XP OS and copy the exe in to system containg the Windowsserver 2008 machine and replace it

So what i did is

i added a manifest like this name of that is myproject.exe.manifest My project has 3 folders like Headerfile,Resourcefile and Source file.I added this manifest(myproject.exe.manifest) in the Sourcefile folder containing other cpp and c code

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
  <assemblyIdentity version="11.1.4.0"
     processorArchitecture="X7460"
     name="myproject"
     type="win32"/> 
  <description>myproject Problem</description> 
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>

then i added this line of code in Resourcefile(.rc).Means one header file is there(Myproject.h).I added the line of code there

#define MANIFEST_RESOURCE_ID 1
MANIFEST_RESOURCE_ID RT_MANIFEST "myproject.exe.manifest"

Finally i did the following step

1.

  Open your project in Microsoft Visual Studio 2005.

2.

  Under Project, select Properties.

3.

  In Properties, select Manifest Tool, and then select Input and Output.

4.

  Add in the name of your application manifest file under Additional manifest files.

5.

  Rebuild your application.

But i am getting lot of Syntax errors

Is there any problems in the way which i followed.If i commented the line

define MANIFEST_RESOURCE_ID 1

MANIFEST_RESOURCE_ID RT_MANIFEST "myproject.exe.manifest" which added in Myproject.h for adding values in .rc file there willnot any error other than this general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. .\myproject.exe.manifest

How to enable UAC prompt through programming

© Stack Overflow or respective owner

Related posts about .NET

Related posts about visual-c++