VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 利用API函数实现隐藏和显示桌面图标
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:9854, 日期:2001-11-26
利用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