Show/Hide icon on desktop windows 7 (VB.NET)


vb Code: On VB 2008 EXP


Public Class Form1

Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32

Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Int32, ByVal nCmdShow As Int32) As Int32

Private Const SW_HIDE As Int32 = 0

Private Const SW_RESTORE As Int32 = 9



Public Sub ShowIcons()

Dim hWnd As Int32

hWnd = FindWindow(vbNullString, "Program Manager")

If Not hWnd = 0 Then

ShowWindow(hWnd, SW_RESTORE)

End If

End Sub


Public Sub HideIcons()

Dim hWnd As Int32

hWnd = FindWindow(vbNullString, "Program Manager")

If Not hWnd = 0 Then

ShowWindow(hWnd, SW_HIDE)

End If

End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Call HideIcons()

End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Call ShowIcons()

End Sub

End Class

ความคิดเห็น