PDA

Click to See Complete Forum and Search --> : i want to know...........


alexandru
Feb 8th, 2001, 08:16 AM
i want to know how to hide the taskbar from a api function. please give me an example

tumblingdown
Feb 8th, 2001, 08:40 AM
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.

Feb 8th, 2001, 01:39 PM
Don't use the SetWindowPos API function, use the ShowWindow API function instead for better results.


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

Feb 8th, 2001, 03:16 PM
Better results?? Both SetWindowPos and ShowWindow send the WM_SHOWWINDOW message, thus they're exactly the same, and neither is better than the other.

Feb 8th, 2001, 03:52 PM
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.

DarkJedi9
Feb 9th, 2001, 09:25 PM
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.

Lord Orwell
Feb 10th, 2001, 02:10 AM
Depends on how quickly you need your message noticed. Postmessage isn't always quickly responded to.

DarkJedi9
Feb 10th, 2001, 08:19 PM
I was just checking to see if it worked.