Invoke the 'Open with' dialog

Knowing a bit of the Windows internals allows you to invoke several system dialogs. Some of these techniques are discussed using the format dialog. The following listing demonstrates how to use RunDll32.exe to invoke the Open with dialog.

'************************************************
' File:  OpenWith.vbs (WSH sample in VBScript)
' Author: (c) G. Born
'
' Invokes the Open With dialog.
'
' In no way shall the author be liable for any
' losses or damages resulting from the use of this
' program. Use AS-IS at your own risk.
'
' The code is the property of the author. You may
' use the code and modify it, as far as this header
' remains intact. Further updates and other samples
' may be found on my site:
' http://www.borncity.de
'************************************************
Option Explicit

Dim WshObj
' Object for the Run-Method

Set WshObj = Wscript.CreateObject("WScript.Shell")

WshObj.Run "RunDll32.exe Shell32.dll,OpenAs_RunDLL", _
            1, true ' launch dialog
' End

Additional information about this sample and more may be found in my WSH books published by Microsoft Press.

Back

(c) G. Born