VBCoding Библиотека кодов Visual Basic 6 Оболочка и система Скрыть/показать иконки рабочего стола

Visual Basic 6
Скрыть/показать иконки рабочего стола

Добавьте на форму 2 CommandButton. Первая кнопка спрячет ярлыки с рабочего стола, вторая - покажет.


'ВАРИАНТ 1
Private Declare Function ShowWindow& Lib "user32" (ByVal hWnd&, ByVal nCmdShow&)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const SW_HIDE = 0
Const SW_NORMAL = 1

Private Sub Command1_Click()
Dim hHandle As Long
hHandle = FindWindow("progman", vbNullString)
Call ShowWindow(hHandle, SW_HIDE)
End Sub

Private Sub Command2_Click()
Dim hHandle As Long
hHandle = FindWindow("progman", vbNullString)
Call ShowWindow(hHandle, SW_NORMAL)
End Sub

'ВАРИАНТ 2
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hWnd As Long, ByVal fEnable As Long) As Long
Const SW_HIDE = 0
Const SW_SHOW = 5

Public Sub Desktop(Visible As Boolean)
Dim hWnd As Long
hWnd = FindWindow("Progman", "Program Manager")
If Visible Then
ShowWindow hWnd, SW_SHOW
Else
ShowWindow hWnd, SW_HIDE
End If
EnableWindow hWnd, Visible
End Sub

Private Sub Command1_Click()
Desktop False
End Sub

Private Sub Command2_Click()
Desktop True
End Sub

 

Источник: http://www.vbnet.ru/ 

 

Добавить комментарий


Защитный код
Обновить

 
VBCoding Библиотека кодов Visual Basic 6 Оболочка и система Скрыть/показать иконки рабочего стола  
Powered by Exponenta -