Results 1 to 7 of 7

Thread: hiding other programs

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Posts
    23

    Post

    I wanna be able to hide a program that is running on my desktop. It doesnt have a title bar and it always stays on top of all other running programs. I dont know what other information someone might need to help me. Please anyone respond with any questions or help (preferably help :-)).

    Thanks,
    Matt

  2. #2
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    You need to know it's Caption, or it's ClassName, then you can use the PostMessage API.

    ------------------
    Tom Young, 14 Year Old
    tyoung@stny.rr.com
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Posts
    23

    Post

    wow thanx for the quick response! and i found out the caption, but the only place ive been able to find anything related the PostMessage API is closing programs. I dont wanna close this program just make it so i can see it. Can you please show me how to do this?

    Matt

  4. #4
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    Sorry, for the long response this time... but in this case, you will want to use the ShowWindow API:
    Code:
    Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
    Public Const SW_HIDE = 0
    Public Const SW_SHOWNORMAL = 1
    Public Sub HideWindow(ByVal hWnd As Long)
        Call ShowWindow(hWnd, SW_HIDE)
    End Sub
    Public Sub ShowWindow(ByVal hWnd As Long)
        Call ShowWindow(hWnd, SW_SHOWNORMAL)
    End Sub

    To get the hWnd, use the FindWindow API:
    Code:
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    MyhWnd = FindWindow(vbNullString, "Calculator")
    ------------------
    Tom Young, 14 Year Old
    tyoung@stny.rr.com
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

    [This message has been edited by Compwiz (edited 11-28-1999).]

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Posts
    23

    Post

    wow like thank you that works like perfect for a large part, but i am having yet another problem. I got a program that would give me the like classname of the windows i want to hide the only problem is that there are four of them and they all have the same class name but when i use what you gave me on them it only hides one of them. I dont mean to ask so many questions but im new to this sorta thing. Can you please show me how i would get it to hide all of them? I would like be way thankful.

    Matt

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    You can use FindWindowEx API to find all windows with the same class name.

    Code:
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
    Public Const SW_HIDE = 0
    Public Const SW_SHOWNORMAL = 1
    
    '------Use this on any event you want
    Dim lCalculator As Long
    
    lCalculator = FindWindowEx(0, 0, "SciCalc", VbNullString)
    Do Until lCalculator = 0
        ShowWindow lCalculator, SW_HIDE
        lCalculator = FindWindowEx(0, lCalculator, "SciCalc", VbNullString)
    Loop
    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Posts
    23

    Post

    Hey thanks you two you really helped me out alot.

    Matt

    [This message has been edited by HexMaster (edited 11-29-1999).]

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