当前位置:编程学习 > VB >>

利用API函数实现隐藏和显示桌面图标

答案:
利用API函数实现隐藏和显示桌面图标
作者:徐建波
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_RESTORE = 9

'隐藏桌面图标
Private Sub Command1_Click()
Dim Hwd As Long
Dim rtn As Long
Hwd = FindWindow("Progman", vbNullString)
rtn = ShowWindow(Hwd, SW_HIDE)
End Sub

'显示桌面图标
Private Sub Command2_Click()
Dim Hwd As Long
Dim rtn As Long
Hwd = FindWindow("Progman", vbNullString)
rtn = ShowWindow(Hwd, SW_RESTORE)
End Sub

上一个:用API函数遍历指定驱动器、目录的文件
下一个:利用Api函数计算Windows从启动后所运行的总时间

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,