Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Visual Basic Programming Code Examples

Visual Basic > Windows and Controls Code Examples

Show the Windows 'Run' Dialog

Show the Windows 'Run' Dialog 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 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