|
|
|
Урок 1 |
Скрыть/показать иконки рабочего стола. |
Добавьте на форму 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()
|
В разделе Примеры, Вы можете скачать пример этого урока. |
|
Назад |
|
|