VB and VBA Users Source Code: Show the Windows "Run" Dialog
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Show the Windows "Run" Dialog
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Friday, November 17, 2000
Hits:
546
Category:
Windows API
Article:
To display the "Run" dialog use the following routine: Private Declare Function SHRunDialog Lib "shell32" Alias "#61" (ByVal hOwner As Long, ByVal Unknown1 As Long, ByVal Unknown2 As Long, ByVal szTitle As String, ByVal szPrompt As String, ByVal uFlags As Long) As Long Private Declare Function GetActiveWindow Lib "user32" () As Long 'Purpose : Shows the run dialog 'Inputs : sTitle The title of the dialog ' sDescription The description text inside the dialog ' bShowLastRun If True displays the last Run in the combo else the combo is empty 'Outputs : 'Author : Andrew Baker 'Date : 17/11/2000 14:17 'Notes : Modified from code found on www.allapi.net 'Revisions : 'Assumptions : Sub ShowRunDialog(Optional sTitle As String = "Start a program ...", Optional sDescription As String = "Type the name of a program ...", Optional bShowLastRun As Boolean = True) Const shrdNoMRUString As Long = &H2 If bShowLastRun Then SHRunDialog GetActiveWindow, 0, 0, StrConv(sTitle, vbUnicode), StrConv(sDescription, vbUnicode), 0 Else SHRunDialog GetActiveWindow, 0, 0, StrConv(sTitle, vbUnicode), StrConv(sDescription, vbUnicode), shrdNoMRUString End If End Sub
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder