locked
UAC prompt for an application RRS feed

  • Question

  • I have application written in VB6(let us say A). This application may sometimes calls another application(let us say B) and runs it. The application "B" does some functions like copying of dll files etc .This application requires administrative privileges.But application A doesn't copy any files or anything else. So can i create application A without UAC prompt displaying for it(bcoz it does not change any system configuration)? Let the UAC prompt only for application B which requires administrative permission.Can i do this anyway?Is it possible not  to prompt UAC for my application A (which does not change any system setting or files)?
    Monday, October 29, 2012 11:33 AM

Answers

  • The best solution (if possible) is to rewrite application 'B' to accomplish task-B without requiring elevation. If that is not possible, then split the two tasks and have your application display a dialog box that enables your user to select between launching one task that requires elevation or a (more limited) task that does not require elevation.  Indicate in your dialog which task requires privileges by displaying the UAC shield icon alongside the name of the appropriate task - as demonstrated in the User Account Control documentation. 
    • Marked as answer by Jie Bao Thursday, November 8, 2012 8:29 AM
    Tuesday, October 30, 2012 8:20 PM
  • Does "runas" will  open the application as administrator? But if run my application B as "runas" does this prevent uac prompt for my application "A"?
    • Marked as answer by Jie Bao Thursday, November 8, 2012 8:29 AM
    Thursday, November 1, 2012 12:40 PM

All replies

  • The best solution (if possible) is to rewrite application 'B' to accomplish task-B without requiring elevation. If that is not possible, then split the two tasks and have your application display a dialog box that enables your user to select between launching one task that requires elevation or a (more limited) task that does not require elevation.  Indicate in your dialog which task requires privileges by displaying the UAC shield icon alongside the name of the appropriate task - as demonstrated in the User Account Control documentation. 
    • Marked as answer by Jie Bao Thursday, November 8, 2012 8:29 AM
    Tuesday, October 30, 2012 8:20 PM
  • If i understood your question correctly, the simple solution is to use ShellExecute() with the "runas" instead of "open" (default) as the lpOperation (2nd) parameter, when you launch the B from A.
    Thursday, November 1, 2012 11:40 AM
  • Does "runas" will  open the application as administrator? But if run my application B as "runas" does this prevent uac prompt for my application "A"?
    • Marked as answer by Jie Bao Thursday, November 8, 2012 8:29 AM
    Thursday, November 1, 2012 12:40 PM
  • Windows Vista Application Development Requirements for User Account Control Compatibility covers UAC in great detail and the guidance there is applicable to Windows 7 and Windows 8.
    Friday, December 21, 2012 8:34 PM