Results 1 to 5 of 5

Thread: Minimize or hide this DOS window

  1. #1

    Thread Starter
    Member
    Join Date
    May 2003
    Posts
    33

    Minimize or hide this DOS window

    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

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Minimize or hide this DOS window

    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

  3. #3

    Thread Starter
    Member
    Join Date
    May 2003
    Posts
    33

    Re: Minimize or hide this DOS window

    can i not do this in VB ?

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Minimize or hide this DOS window

    Run it like this?

    VB Code:
    1. Shell "batchfilename.bat", vbHide

    ?


    Has someone helped you? Then you can Rate their helpful post.

  5. #5
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Minimize or hide this DOS window

    Ive got the perfect code for you ; )
    VB Code:
    1. Option Explicit
    2. Const SWP_HIDEWINDOW = &H80
    3. Const SWP_SHOWWINDOW = &H40
    4. 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
    5. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    6. Dim tWnd As Long
    7. Dim frmname As String
    8. Private Sub Form_Load()
    9. frmname = "ConsoleWindowClass"
    10. tWnd = FindWindow(frmname, vbNullString) ' Change stuff in quotes so it will shrink it!! i.e. for paint it would be "paint"
    11.     MsgBox tWnd
    12.     If tWnd <> 0 Then
    13.         SetWindowPos tWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW
    14.     Else: MsgBox frmname & " not found!"
    15.     End If
    16. End Sub
    17.  
    18. Private Sub Form_Unload(Cancel As Integer)
    19.     SetWindowPos tWnd, 0, 200, 0, 100, 100, SWP_SHOWWINDOW
    20.     MsgBox tWnd
    21. End Sub
    Last edited by |2eM!x; Mar 24th, 2005 at 05:37 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width