In my program, in the Form_Unload event, I use shell to open another application, the problem is that the application open but stay in the taskbar. How can I give the focus to this application ?
Printable View
In my program, in the Form_Unload event, I use shell to open another application, the problem is that the application open but stay in the taskbar. How can I give the focus to this application ?
VB Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Const SW_SHOWNORMAL = 1 Private Sub Command1_Click() ShellExecute Me.hwnd, vbNullString, "YourFileName", vbNullString, "C:\", SW_SHOWNORMAL End Sub
Or use the vbNormalFocus parameter :
VB Code:
Shell "YourApplication", [b]vbNormalFocus[/b]
Thanks, it is working! :)