-
I have to open up an application that isn't .exe. Therefore the shell command wont work. How else can I open up this application from within my VB program and have it hidden but still keep its focus (like the vbHide constant for the shell function). I remember doing this last year but I dont remember how (brain fart!).
Thanks for your help in advance,
Brandr Beekman
[email protected]
-
Use the ShellExecute API.
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
Const SW_SHOW = 5
Const SW_HIDE = 0
Private Sub Command1_Click()
'Open Myfile.txt with it's associated program
ShellExecute Me.hwnd, "open", "C:\MyFile.txt", "", "C:\Windows\Desktop\", SW_HIDE
End Sub
Or if you know what program opens it, you can shell it and pass the filename for the command line argument.
Code:
Shell "C:\Windows\Notepad C:\MyFile.txt", vbHide
-
Thanks
Thanks for your help!
-Brandr