如何让任务栏自动隐藏?效果与在任务栏上右键打开任务栏属性选择“自动隐藏”一样!

laolux 2003-05-29 07:52:18
并不是简单地使任务栏窗口TrayWnd的visiable=false,因为这样隐藏任务栏的话,其它窗口最大化时不能连任务栏部分也覆盖。
...全文
261 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
icedot 2003-06-18
  • 打赏
  • 举报
回复
来晚了,让 dyx(天火) 抢先了。。给 dyx(天火) 分吧。呵呵,UP一下吧
dyx 2003-06-01
  • 打赏
  • 举报
回复
'控制桌面图标和状态条的可见性
Public Const SW_HIDE = 0 ' Hide Window
Public Const SW_SHOW = 5 ' Show Window
Public Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Public 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
Function Fun_DisplayTaskBar(ByVal bShow As Boolean) As Integer '显示/隐藏 状态栏
Dim lTaskBarHWND As Long
Dim lRet As Long
Dim lFlags As Long
On Error GoTo vbErrorHandler

lFlags = IIf(bShow, SW_SHOW, SW_HIDE)
lTaskBarHWND = FindWindow("Shell_TrayWnd", "")
lRet = ShowWindow(lTaskBarHWND, lFlags)
If lRet < 0 Then
Exit Function
End If

vbErrorHandler:
End Function

Function Fun_DisplayDeskTopIcons(ByVal bShow As Boolean) As Integer '显示/隐藏 桌面图标
Dim lDesktopHwnd As Long
Dim lFlags As Long
On Error Resume Next

lDesktopHwnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
If lDesktopHwnd = 0 Then
Exit Function
End If
lFlags = IIf(bShow, SW_SHOW, SW_HIDE)
ShowWindow lDesktopHwnd, lFlags
End Function
laolux 2003-05-31
  • 打赏
  • 举报
回复
我试过ABM_SETAUTOHIDEBAR了,不行啊?
道素 2003-05-30
  • 打赏
  • 举报
回复
用SHAppBarMessage

定义
Const ABM_GETTASKBARPOS = &H5
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
End Type
使用
Dim data As APPBARDATA
data.cbSize = Len(data)
Call 使用(ABM_GETTASKBARPOS, data)
' data.rc.Left 等於工作列的左边界
' data.rc.Top 等於工作列的上边界
' data.rc.Right 等於工作列的右边界
' data.rc.Bottom 等於工作列的下边界

请注意以上求出之工作列位置及大小是以 pixel(像素) 为单位。

( ">
)(
// )
shannon--//""--
-/------ch21st@hotmail.com
mndsoft 2003-05-30
  • 打赏
  • 举报
回复
windows隐藏开启任务栏的机制就是修改注册表,具体哪个键值,我一时不记得,不过,你可以用注册表监视或快照的工具,比如RegSnap、Regmon等进行找!
xiaoxinghappy 2003-05-30
  • 打赏
  • 举报
回复
'可以的,用 ABM_SETAUTOHIDEBAR 可以设置显示或自动隐藏属性

SHAppBarMessage


WINSHELLAPI UINT APIENTRY SHAppBarMessage(
DWORD dwMessage,
PAPPBARDATA pData
);

Sends an appbar message to the system.

Returns a message-dependent value. For more information, see the Microsoft Platform SDK documentation for the appbar message sent.
dwMessage
Appbar message value to send. This parameter can be one of the following values: ABM_ACTIVATE Notifies the system that an appbar has been activated.
ABM_GETAUTOHIDEBAR Retrieves the handle to the autohide appbar associated with a particular edge of the screen.
ABM_GETSTATE Retrieves the autohide and always-on-top states of the Windows taskbar.
ABM_GETTASKBARPOS Retrieves the bounding rectangle of the Windows taskbar.
ABM_NEW Registers a new appbar and specifies the message identifier that the system should use to send notification messages to the appbar.
ABM_QUERYPOS Requests a size and screen position for an appbar.
ABM_REMOVE Unregisters an appbar, removing the bar from the system's internal list.
ABM_SETAUTOHIDEBAR Registers or unregisters an autohide appbar for an edge of the screen.
ABM_SETPOS Sets the size and screen position of an appbar.
ABM_WINDOWPOSCHANGED Notifies the system when an appbar's position has changed.

pData
Address of an APPBARDATA structure. The content of the structure depends on the value set in the dwMessage parameter.

--------------------------------------------------------------------------------
laolux 2003-05-30
  • 打赏
  • 举报
回复
SHAppBarMessage好像只能得到是否“自动隐藏”的状态,而不能设定为“自动隐藏”!

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧