vb中隐藏任务栏的语句是什么
推荐于2016-04-02 · 知道合伙人软件行家
关注
展开全部
VB6.0需要使用Windows Api函数实现隐藏和显示任务栏。
FindWindow函数检索句柄到顶层窗口的类名和窗口名称匹配指定的字符串。此功能不搜索子窗口。该功能不执行区分大小写的搜索。
IsWindowVisible函数检索指定窗口的可见性状态。
ShowWindow函数设置指定窗口的显示状态。
实现代码:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Sub Command1_Click()
Dim hwnd As Long
hwnd = FindWindow("Shell_TrayWnd", "") '取任务栏窗口句柄
If IsWindowVisible(hwnd) <> 0 Then '如果任务栏是可视状态
ShowWindow hwnd, 0 '隐藏任务栏
Else
ShowWindow hwnd, 1 '显示任务栏
End If
End Sub
效果:
展开全部
隐藏任务栏是什么意思呢?
把窗体的BorderStyle属性设为3,是不是这个效果啊
把窗体的BorderStyle属性设为3,是不是这个效果啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Sub Command1_Click()
Dim hwnd As Long
hwnd = FindWindow("Shell_TrayWnd", "") '取任务栏窗口句柄
If IsWindowVisible(hwnd) <> 0 Then '如果任务栏是可视状态
ShowWindow hwnd, 0 '隐藏任务栏
Else '否则
ShowWindow hwnd, 1 '显示任务栏
End If
End Sub
这个比一楼的简单一点
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Sub Command1_Click()
Dim hwnd As Long
hwnd = FindWindow("Shell_TrayWnd", "") '取任务栏窗口句柄
If IsWindowVisible(hwnd) <> 0 Then '如果任务栏是可视状态
ShowWindow hwnd, 0 '隐藏任务栏
Else '否则
ShowWindow hwnd, 1 '显示任务栏
End If
End Sub
这个比一楼的简单一点
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
网上有很多例子,用API实现的比较多,比如下面这个:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) 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 CMD_ShowBar_Click()
Dim Wnd As Long
Wnd = FindWindow("Shell_TrayWnd", vbNullString)
ShowWindow Wnd, SW_SHOW
End Sub
Private Sub CMD_HideBar_Click()
Dim Wnd As Long
Wnd = FindWindow("Shell_TrayWnd", vbNullString)
ShowWindow Wnd, SW_HIDE
End Sub
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) 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 CMD_ShowBar_Click()
Dim Wnd As Long
Wnd = FindWindow("Shell_TrayWnd", vbNullString)
ShowWindow Wnd, SW_SHOW
End Sub
Private Sub CMD_HideBar_Click()
Dim Wnd As Long
Wnd = FindWindow("Shell_TrayWnd", vbNullString)
ShowWindow Wnd, SW_HIDE
End Sub
追问
我看不懂...还有别的方法吗???
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询