hi,
when i run a batch file it always pop up a DOS window on my windows 2000 computer.
how can i Minimize or hide this DOS window?
thanks
Printable View
hi,
when i run a batch file it always pop up a DOS window on my windows 2000 computer.
how can i Minimize or hide this DOS window?
thanks
You would have to try the other parameters with SHELL, as I am not sure which ones work, but they should be the same or similar.
Or you can use ShellExecute, found here
http://www.mentalis.org/apilist/ShellExecute.shtml
can i not do this in VB ?
Run it like this?
VB Code:
Shell "batchfilename.bat", vbHide
?
Ive got the perfect code for you ; )
VB Code:
Option Explicit Const SWP_HIDEWINDOW = &H80 Const SWP_SHOWWINDOW = &H40 Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Dim tWnd As Long Dim frmname As String Private Sub Form_Load() frmname = "ConsoleWindowClass" tWnd = FindWindow(frmname, vbNullString) ' Change stuff in quotes so it will shrink it!! i.e. for paint it would be "paint" MsgBox tWnd If tWnd <> 0 Then SetWindowPos tWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW Else: MsgBox frmname & " not found!" End If End Sub Private Sub Form_Unload(Cancel As Integer) SetWindowPos tWnd, 0, 200, 0, 100, 100, SWP_SHOWWINDOW MsgBox tWnd End Sub