Click to See Complete Forum and Search --> : Auto hiding Taskbar through VB
faizi
Dec 27th, 2000, 10:31 AM
What is the procedure of Auto hiding Taskbar through VB Programming
I don't think there is a way put on Auto Hide, at least not that I know of. I searched the Registry, can't seem to find it, search INI files, can't find it there either (unless I'm not a good searcher).
But you can hide and show the taskbar:
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As _
Long) As Long
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Dim tray&
Dim shtray&
Private Sub Command1_Click()
'Hide
tray& = FindWindow("Shell_TrayWnd", vbNullString)
shtray& = ShowWindow(tray&, SW_HIDE)
End Sub
Private Sub Command2_Click()
'Show
tray& = FindWindow("Shell_TrayWnd", vbNullString)
shtray& = ShowWindow(tray&, SW_SHOW)
End Sub
Jop
Dec 27th, 2000, 04:57 PM
Well, it should be possible with the SHAppbarmessage, but I just can't get it to work :(
Option Explicit
Const ABS_AUTOHIDE = &H1
Const ABS_ONTOP = &H2
Const ABM_GETSTATE = &H4
Const ABM_GETTASKBARPOS = &H5
Const ABM_SETAUTOHIDEBAR = &H8
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long ' message specific
End Type
Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
Private Sub Form_Paint()
Dim ABD As APPBARDATA, Ret As Long
ABD.cbSize = Len(ABD)
ABD.hwnd = Me.hwnd
ABD.lParam = ABS_AUTOHIDE
ABD.uCallbackMessage = ABS_AUTOHIDE
SHAppBarMessage ABM_SETAUTOHIDEBAR, ABD
Ret = SHAppBarMessage(ABM_GETSTATE, ABD)
If (Ret And ABS_AUTOHIDE) Then Me.Print "Autohide option is on"
End Sub
It should be possible so good luck, and be sure to lemme know when you got it to work ;)
Chris
Dec 28th, 2000, 12:51 AM
Here another alternative way to do it.
'Put this code into a basic module file
Option Explicit
Dim handleW1 As Long
Public Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public 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
Public Function HideTaskbar()
handleW1 = FindWindowA("Shell_traywnd", "")
Call SetWindowPos(handleW1, 0, 0, 0, 0, 0, TOGGLE_HIDEWINDOW)
End Function
Public Function UnhideTaskbar()
Call SetWindowPos(handleW1, 0, 0, 0, 0, 0, TOGGLE_UNHIDEWINDOW)
End Function
'Put this code into a form
Private Sub CmdAction_Click()
If CmdAction.Caption = "Hide" Then
HideTaskbar
CmdAction.Caption = "UnHide"
Else
UnhideTaskbar
CmdAction.Caption = "Hide"
End If
Cheers!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.