Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling Windows Run

57 views
Skip to first unread message

F_Lasting

unread,
Nov 16, 2005, 1:13:07 PM11/16/05
to
How can I call windows Run dialogue box? I thought it was:
RUNDLL32.EXE SHELL32.DLL,Open_RunDLL

Does anyone know what the call is?

Thanks
Frank

mr_unreliable

unread,
Nov 16, 2005, 5:08:15 PM11/16/05
to
Frank, I can't figure out why you want the run dialog,
shell.run works perfectly well, and will do almost
anything the run dialog will do.

However, if you _MUST_ have the run dialog, then
this will do it:

Set oShellApp = CreateObject("Shell.Application")
oShellApp.FileRun

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

F_Lasting

unread,
Nov 16, 2005, 5:15:15 PM11/16/05
to
Wow! Great site. But I did not find the call that I need. Anyone else
knows the call to bring up the Run dialog box?

Frank


"ESP" wrote:

> This is the reference I use often.
> http://www.dx21.com/SCRIPTING/RUNDLL32/REFGUIDE.ASP
>
> ESP

ESP

unread,
Nov 16, 2005, 5:18:38 PM11/16/05
to
This is the reference I use often.
http://www.dx21.com/SCRIPTING/RUNDLL32/REFGUIDE.ASP

ESP

mr_unreliable

unread,
Nov 16, 2005, 5:44:15 PM11/16/05
to
If you don't happen to have "shell.application" installed
(some folks don't), _AND_ you don't mind using a 3rd-party
control (DynaWrap), then this script will get you the
run dialog.

--- <snip> ---
Const VK_LWIN = &H5B ' the "windows" key
Const VK_ACTION = &H52 ' &H52 is the character code for 'R' (ascii 82)
Const KEYEVENTF_KEYUP = &H2

Dim oDW : Set oDW = CreateObject("DynamicWrapper") ' instantiate dynawrap
oDW.Register "USER32.DLL", "keybd_event", "i=ttll", "f=s" ' declare
api (no return value)

Call oDW.keybd_event(VK_LWIN, 0, 0, 0) ' depress winkey
Call oDW.keybd_event(VK_ACTION, 0, 0, 0) ' depress "r"
Call oDW.keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0) ' release winkey

' note: this will start the "run dialog", from then on
' you will have to use appactivate and sendkeys to use it...

MsgBox("you should be seeing the run dialog now")
WScript.Quit
--- </snip> ---

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

--- <DynaWrap Boilerplate> ---
It is possible to declare-and-call an api from script,
but you must use a third-party control to do so,
or else write one yourself.

It has already been correctly pointed out that there
is no api-capability in "pure" script.

If you are willing to use a third-party control, then
one such control, called "DynaWrap", can be found on
Guenter Born's website (note: Guenter refers to it as
"DynaCall"). Here is the link to it:

http://people.freenet.de/gborn/WSHBazaar/WSHDynaCall.htm

On that page you will find a download for the control,
plus some code samples.

Note: you may find additional sample code by searching
the archives for this ng, and the vbscript ng.

Note also: DynaWrap does have its limitations. There are
certain things it can't do. For example, you can't call
api's which take typedefs as parameters, and you can't call
api's "by ordinal". But it will work for most of the
"usual suspects".

And finally, DynaWrap doesn't work entirely as advertised.
For example, it is supposed to allow for the declaration of
several api definitions in one instance of itself. I could
never get that to work (in win9x). You will need a new
instance of DynaWrap for every api, or else re-instantiate
the object for every api. Someday I'm going to learn enough
c++ to fix that...
--- </DynaWrap Boilerplate> ---

F_Lasting

unread,
Nov 16, 2005, 7:55:02 PM11/16/05
to
Thanks folks.
0 new messages