|
-
Oct 11th, 2000, 09:50 AM
#1
Thread Starter
Hyperactive Member
Hi! I used these codes http://www.vb-world.net/tips/tip5.html to know when an application with the shell command is finish but, how do I hide the window? I know with the shell command, you add ", VbHide" but I do not see any shell command. Do you guys have an idea?
-
Oct 11th, 2000, 10:12 AM
#2
Member
Hide what window? The call itself doesnt generate a window.
If you are talking about the form you used it with then just do a form1.visible = false.
hope this helps
-
Oct 11th, 2000, 10:15 AM
#3
Thread Starter
Hyperactive Member
!
I tried out this code and it produce a window! I try to execute a DOS program!
-
Oct 11th, 2000, 10:21 AM
#4
Frenzied Member
Code:
Private Const STARTF_USESHOWWINDOW = &H1
Public Enum enSW
SW_HIDE = 0
SW_NORMAL = 1
SW_MAXIMIZE = 3
SW_MINIMIZE = 6
End Enum
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib _
"kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds _
As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" _
(ByVal lpApplicationName As Long, ByVal lpCommandLine As _
String, ByVal lpProcessAttributes As Long, ByVal _
lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As Long, lpStartupInfo As _
STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) _
As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject _
As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Sub ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
'Initialize the STARTUPINFO structure:
start.cb = Len(start)
start.dwFlags = STARTF_USESHOWWINDOW
start.wShowWindow = SW_HIDE
'Start the shelled application:
ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
'Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub
Private Sub Form_Load()
ExecCmd "Notepad.exe"
End Sub
But I don't recommend shelling it Hidden, because you can only end it with CTRL+ALT+DELETE, and your prog won't continue until it's closed!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 11th, 2000, 12:16 PM
#5
Member
that's not true. If he uses the 'command.com /c' before it (or 'cmd.exe /c' in NT) then it will close the dos box when it's finished.
e.g.:
c:\command.com /c c:\windows\pbrush.exe
that line will load paintbrush and close the dos textbox right after it does so.
hope this helps
-
Oct 11th, 2000, 12:44 PM
#6
Lively Member
Isn't there a flag???
I might sound like a newbie but isn't there a flag, such as,
Shell "C:\Windows\Explorer.exe" , 1
or some number like that?
I would check for u but I'm in highschool <
-Justin
-
Oct 11th, 2000, 01:02 PM
#7
Member
justin,
it's not the shell command he(or she) is trying to use but a function that does the same thing except it can detect when the program it calls ends. Otherwise, yes the Shell command does have a flag for that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|