Results 1 to 6 of 6

Thread: simple one

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    49
    let say i do a shell command,
    example:
    a=shell("format a:",VBHIDE)

    and when i push a command button,
    i want to put the a=shell("format a:,VBHIDE)
    in VBNORMAL, so the process of dos pops in the user's face
    is there a way to do that
    thanxs

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Hey, how are you doing?

    use this code

    Code:
    Private Sub Form_Load()
       a=shell("format a:",VBNORMAL) 
       ShowHideWindow("MYCLASSNAME", "ORMYCAPTION", False)
    End Sub
    
    Private Sub Command1_Click()
       ShowHideWindow("MYCLASSNAME", "ORMYCAPTION", True)
    End Sub
    
    '[begin of code]
    'Author: Jop
    'Origin: Inspired by some post on this forum (can't remember who)
    'Purpose: Show or hide a window without unloading it.
    'Version: VB5+
    
    'Api calls
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    
    Dim Myhwnd As Long, showme As Integer
    Private Sub ShowHideWindow(Classname As String, WindowCaption As String, Show As Boolean)
    If Classname = "" Then Classname = vbNullString
    If WindowCaption = "" Then WindowCaption = vbNullString
    'Find the window by either his classname or caption
        Myhwnd = FindWindow(Classname, WindowCaption)
    'if found
        If Myhwnd <> 0 Then
        If Show = True Then
        showme = 5
        Else
        showme = 0
        End If
    'Show or hide the window
        ShowWindow Myhwnd, showme
        End If
    End Sub
    'Usage: 
    'ShowHideWindow "MYHANDLE", "MYCAPTION", True/False
    '[end of code]
    Have fun with it man
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    49

    hide-normal focus

    hey man what's up,little problem
    do u just write "MYCLASSNAME","ORMYCAPTION" in the parameter sent to the ShowHideWindow

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    The ORMYCAPTION = the caption of the window, the MYCLASSNAME is the classname of the window, so just choose between the 2, if the window you opened has an classname like Calculator then use

    ShowHideWindow("","Calculator",false)
    to hide the Calculator.

    I believe the shelled Format a: has a classname called WinOldApp, so you could do:
    ShowHideWindow("WinOldApp","",True)

    to show the Format Dialog.

    Have fun
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    49

    final one

    what if my shell include batch files
    example shell("c:\test.bat")
    is there a class for that
    thanxs for your time

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    That's probably the same as the caption name (Ended: test.bat or something )
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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