Results 1 to 8 of 8

Thread: i want to know...........

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2001
    Location
    Targoviste, Romania, Europe, Earth
    Posts
    27

    Exclamation

    i want to know how to hide the taskbar from a api function. please give me an example
    This is little' oh me mister don't give a ... still won't bleed
    EmInEm

  2. #2
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    MSDN]
    Option Explicit

    Dim handleW1 As Long

    Private Declare Function FindWindowA Lib "user32" _
    (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long

    Private Declare Function SetWindowPos Lib "user32" _
    (ByVal handleW1 As Long, _
    ByVal handleW1InsertWhere As Long, ByVal w As Long, _
    ByVal x As Long, ByVal y As Long, ByVal z As Long, _
    ByVal wFlags As Long) As Long

    Const TOGGLE_HIDEWINDOW = &H80
    Const TOGGLE_UNHIDEWINDOW = &H40

    Function HideTaskbar()
    handleW1 = FindWindowA("Shell_traywnd", "")
    Call SetWindowPos(handleW1, 0, 0, 0, _
    0, 0, TOGGLE_HIDEWINDOW)
    End Function

    Function UnhideTaskbar()
    Call SetWindowPos(handleW1, 0, 0, 0, _
    0, 0, TOGGLE_UNHIDEWINDOW)
    End Function

    td.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  3. #3
    Guest
    Don't use the SetWindowPos API function, use the ShowWindow API function instead for better results.


    Code:
    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
    
    Private Const SW_HIDE = 0
    Private Const SW_SHOW = 5
    
    
    Private Sub Command1_Click()
    
        'Hide
        Dim shelltraywnd As Long
        shelltraywnd = FindWindow("shell_traywnd", vbNullString)
        ShowWindow shelltraywnd, SW_HIDE
    
    End Sub
    
    
    Private Sub Command2_Click()
    
        'Show
        Dim shelltraywnd As Long
        shelltraywnd = FindWindow("shell_traywnd", vbNullString)
        ShowWindow shelltraywnd, SW_SHOW
    
    End Sub

  4. #4
    Guest
    Better results?? Both SetWindowPos and ShowWindow send the WM_SHOWWINDOW message, thus they're exactly the same, and neither is better than the other.

  5. #5
    Guest
    I see now. Perhaps I missed a few things to that code.
    I thought the SetWindowPos API function only set windows on top or on bottom. I see it hides and unhides as well.

  6. #6
    Lively Member
    Join Date
    Jun 2000
    Posts
    124
    Originally posted by Megatron
    Better results?? Both SetWindowPos and ShowWindow send the WM_SHOWWINDOW message, thus they're exactly the same, and neither is better than the other.
    So couldn't you also use postmessage to post the wm_showwindow message and pass the hide or unhide argument? I'm just hypothesizing here; so don't get too technical about my argument names and all that. I'm just wondering about whether or not postmessage would work as well.
    On Error Resume Screaming...

  7. #7
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    Depends on how quickly you need your message noticed. Postmessage isn't always quickly responded to.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  8. #8
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    Cool Gotcha

    I was just checking to see if it worked.
    On Error Resume Screaming...

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