Jump to content
Sign in to follow this  
KaFu

HowTo invoke windows standard RunAs dialog

Recommended Posts

KaFu

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

Share this post


Link to post
Share on other sites
Zohar

I am sure it is possible to call it via Run(), and If I was you I would search for it via google.

If you don't find however, you can always use

CODE

Send("{LWin}")

Send("{R}")

Share this post


Link to post
Share on other sites
KaFu

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
Share on other sites
KaFu

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

Share this post


Link to post
Share on other sites
gilgul

Dialog not appear in WIn7. How make it in Win7?

Share this post


Link to post
Share on other sites
JLogan3o13

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Melba23

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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
Sign in to follow this  

×