VB 隐藏桌面图标与显示图标,并非是调用桌面上右键显示图标的功能;因为如果用的是桌面上右键的功能,在桌面上还可以右键去显示图标;代码很简单;添加一个command1与commmand2
写入以下代码;
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 LongDim rtn As Long
Hwd = FindWindow("Progman", vbNullString)
rtn = ShowWindow(Hwd, SW_RESTORE)
End Sub