none
Autostart permission RRS feed

  • Question

  • My application featured to set the key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run to run automaticly when user logged on, but it seems if you want to set the value in registry, you need to right click the application, and select "Run as administrator", other wise, it won't have permission. But I found other application don't need to right click, and also can access the register, how did they do.
    Friday, May 4, 2012 5:31 AM

Answers

  • Goto Project Menu-> Select 'Add New Item'. This opens Add New Item dialog. From this, select "Application Manifest File" and click ok. relace the existing contents with below,

    <?xml version="1.0" encoding="utf-8" ?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" >
      <assemblyIdentity version="1.0.0.0"  processorArchitecture="X86"  name="someExecName"  type="win32" />
      <description>Program description</description>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" />
          </requestedPrivileges>
        </security>
      </trustInfo>
    </assembly>

    I hop this helps.

    Please mark this post as answer if it solved your problem. Happy Programming!

    Friday, May 4, 2012 6:36 AM

All replies

  • Goto Project Menu-> Select 'Add New Item'. This opens Add New Item dialog. From this, select "Application Manifest File" and click ok. relace the existing contents with below,

    <?xml version="1.0" encoding="utf-8" ?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" >
      <assemblyIdentity version="1.0.0.0"  processorArchitecture="X86"  name="someExecName"  type="win32" />
      <description>Program description</description>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" />
          </requestedPrivileges>
        </security>
      </trustInfo>
    </assembly>

    I hop this helps.

    Please mark this post as answer if it solved your problem. Happy Programming!

    Friday, May 4, 2012 6:36 AM
  • Is that if I use these codes above, then the app will require UAC permission everytime when user run the app, or it don't need UAC any more but it still can access the register.
    Monday, May 7, 2012 11:31 AM
  • That code above, when added to application, makes the application run with admin privilages. It is similar to right click and select run as administrator. If the user is not an administrator, then yes, UAC will popup.


    Please mark this post as answer if it solved your problem. Happy Programming!

    Tuesday, May 8, 2012 2:49 AM
  • ok, I got it, but how to requeire UAC access when user click the checkbox, not every time the app starts. I mean request UAC when it needs.

    Tuesday, May 8, 2012 4:42 AM
  • Below is exactly similar discussion. I hope you will find your answer there. Check it out.

    http://stackoverflow.com/questions/573086/how-to-elevate-privileges-only-when-required


    Please mark this post as answer if it solved your problem. Happy Programming!

    Tuesday, May 8, 2012 5:02 AM
  • Thanks very much
    Wednesday, May 9, 2012 2:01 AM