Copy and paste the following code
---------------------------------------
Option Explicit
'The FindWindow function retrieves a handle to the top-level window whose class name and window name match the specified strings
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
'The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
'The ShowWindow function sets the specified window's show state
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_SHOW = 5 'Shows A Window
Private Const SW_HIDE = 0 'Hides A Window
Private Sub Command1_Click()
Dim TaskBarWin As Long 'TaskBar Window
Dim StartButton As Long 'Start Button Window
TaskBarWin = FindWindow("shell_traywnd", vbNullString) 'Get Taskbar Window
StartButton = FindWindowEx(TaskBarWin, 0&, "button", vbNullString) 'Get StartButton Window
Call ShowWindow(StartButton, SW_HIDE)
End Sub
To Get Getback the Button
Dim TaskBarWin As Long 'TaskBar Window
Dim StartButton As Long 'Start Button Window
TaskBarWin = FindWindow("shell_traywnd", vbNullString) 'Get Taskbar Window
StartButton = FindWindowEx(TaskBarWin, 0&, "button", vbNullString) 'Get StartButton Window
Call ShowWindow(StartButton, SW_SHOW)
0 comments:
Post a Comment