Jump to content

HowTo invoke windows standard RunAs dialog


KaFu
 Share

Recommended Posts

Hello Forum,

does anyone know, how to invoke windows standard RunAs dialog? I know of RunAs() for course, but i want to start the build-in dialog. Have search for something like a shell32.dll call without luck.

Best Regards

Edited by KaFu
Link to comment
Share on other sites

Hello Forum,

does anyone know, how to invoke windows standard RunAs dialog? I know of RunAs() for course, but i want to start the build-in dialog. Have search for something like a shell32.dll call without luck.

Best Regards

That dialog is for the program so you don't just invoke it like some other stuff.

What you need is function ShellExecute from shell32.dll

But AutoIt has that as built-in function allowing you to do something like this:

MsgBox(64, "Normal mode", "IsAdmin: " & IsAdmin() & @CRLF & "Will go to elevated mode after you click OK")

ShellExecuteWait(@AutoItExe, '/AutoIt3ExecuteLine  "MsgBox(64, ''Elevated mode'', ''IsAdmin: '' & IsAdmin())"', @ScriptDir, "runas")

MsgBox(64, "Normal mode again", "IsAdmin: " & IsAdmin() & @CRLF & "UAC again follows")

ShellExecuteWait(@AutoItExe, '/AutoIt3ExecuteLine  "MsgBox(64, ''Elevated mode again'', ''IsAdmin: '' & IsAdmin())"', @ScriptDir, "runas")

Results depends on your current status, your choices and OS.

Of course that you can run other programs like this.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Perfect, that's what I was searching for :) ...

ShellExecute(@ComSpec,'/k',@ScriptDir,'runas')

Want to use it to allow the user to invoke any exe this way from SMF's result report.

Verb 'runas' is not in the documentation :lmao:.

Thanks a bunch for this one

Best Regards

Link to comment
Share on other sites

  • 4 years later...
  • Moderators

Gilgul, please do not resurrect a 4 year old thread. AutoIt is constantly evolving, and what may have worked in 2009 may be completely different today. Please open a new thread and describe in detail what you're trying to accomplish; I guarantee you will get a much better response.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

gilgul,

JLogan3o13 makes a good point - please do not do something like this again. But welcome to the AutoIt forums anyway. ;)

In response to the report,

If the necro-question is self-contained and so can be split off easily, then by all means report it - if not (as in this case) it makes little sense to split it, so just comment in the thread for the poster's future wisdom. Thanks for your cooperation. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...