vb.net - Visual Basic Shell Administrator? -


if i'm using visual basic run executable using shell() command, how run executable administrator? method works, @ least in practice, 1 executable won't run , think that's issue.

here's example of command i'm trying run.

shell("%temp%\ninite.exe") 

edit: sorry, vb.net, not vba. put bad tag on there.

to stay strictly in vba no .net dependencies, should able use shellexecute win32 function.

private declare function shellexecute lib "shell32.dll" alias "shellexecutea" ( _         byval hwnd long, _         byval lpoperation string,          byval lpfile string, _         byval lpparameters string, _         byval lpdirectory string, _         byval nshowcmd long) long  

you can pass "runas" lpoperation instead of more usual "open" (commonly called verb). note may cause dialog box come prompting user credentials.

a better way might use createprocess or createprocessasuser function powerful way launch in windows, more complex , cannot tell details of how work right.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -