Các chiêu thức trong lập trình Ẩn thanh Taskbar hoặc các thành phần khác

2 315 0
Tài liệu đã được kiểm tra trùng lặp
Các chiêu thức trong lập trình Ẩn thanh Taskbar hoặc các thành phần khác

Đang tải... (xem toàn văn)

Thông tin tài liệu

Ẩn thanh Taskbar hoặc các thành phần khác Binh khí : (Nếu bạn muốn test thì tự vẽ thêm các đối tượng vì đoạn code đã tương đối chi tiết) Xuất xứ : www.pscode.com Đoạn mã Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long 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 Private Const SWP_SHOWWINDOW = &H40 Private Const SWP_HIDEWINDOW = &H80 Private Const SWP_FRAMECHANGED = &H20 Private TaskBarhWnd As Long Private StartButtonhWnd As Long Private SysTrayhWnd As Long Private ClockhWnd As Long Private FirstBarhWnd As Long Private SecondBarhWnd As Long Private ThirdBarhWnd As Long Private FourthBarhWnd As Long Public Function HideTaskBarParts(whattohide As String) As Boolean TaskBarhWnd = FindWindow("Shell_TrayWnd", "") StartButtonhWnd = FindWindowEx(TaskBarhWnd, 0, "Button" & vbNullString, vbNullString) SysTrayhWnd = FindWindowEx(TaskBarhWnd, 0, "traynotifywnd" & vbNullString, vbNullString) ClockhWnd = FindWindowEx(SysTrayhWnd, 0, "TrayClockWClass" & vbNullString, vbNullString) FirstBarhWnd = FindWindowEx(TaskBarhWnd, 0, "ReBarWindow32" & vbNullString, vbNullString) SecondBarhWnd = FindWindowEx(FirstBarhWnd, 0, "ToolBarWindow32" & vbNullString, vbNullString) ThirdBarhWnd = FindWindowEx(FirstBarhWnd, 0, "MSTaskSwWClass" & vbNullString, vbNullString) FourthBarhWnd = FindWindowEx(ThirdBarhWnd, 0, "SysTabControl32" & vbNullString, vbNullString) If TaskBarhWnd = 0 Or StartButtonhWnd = 0 Or SysTrayhWnd = 0 Or ClockhWnd = 0 Or FirstBarhWnd = 0 Or SecondBarhWnd = 0 Or ThirdBarhWnd = 0 Or FourthBarhWnd = 0 Then MsgBox "Error recieving window handles !!!", vbCritical, "No hWnd detected" Exit Function End If If whattohide = "Taskbar" Then X = SetWindowPos(TaskBarhWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW) ElseIf whattohide = "Systray" Then X = SetWindowPos(SysTrayhWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW) ElseIf whattohide = "Clock" Then X = SetWindowPos(ClockhWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW) ElseIf whattohide = "Quickstart" Then X = SetWindowPos(SecondBarhWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW) ElseIf whattohide = "Tasklist" Then X = SetWindowPos(ThirdBarhWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW) ElseIf whattohide = "Startbutton" Then X = SetWindowPos(StartButtonhWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW) Else X = 0 End If HideTaskBarParts = X End Function Public Function ShowTaskBarParts(whattoshow As String) As Boolean If whattoshow = "Taskbar" Then X = SetWindowPos(TaskBarhWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW) ElseIf whattoshow = "Systray" Then X = SetWindowPos(SysTrayhWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW) ElseIf whattoshow = "Clock" Then X = SetWindowPos(ClockhWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW) ElseIf whattoshow = "Quickstart" Then X = SetWindowPos(SecondBarhWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW) ElseIf whattoshow = "Tasklist" Then X = SetWindowPos(ThirdBarhWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW) ElseIf whattoshow = "Startbutton" Then X = SetWindowPos(StartButtonhWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW) Else X = 0 End If Call SetWindowPos(TaskBarhWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED) ShowTaskBarParts = X End Function . Ẩn thanh Taskbar hoặc các thành phần khác Binh khí : (Nếu bạn muốn test thì tự vẽ thêm các đối tượng vì đoạn code đã tương. HideTaskBarParts(whattohide As String) As Boolean TaskBarhWnd = FindWindow("Shell_TrayWnd", "") StartButtonhWnd = FindWindowEx(TaskBarhWnd,

Ngày đăng: 24/10/2013, 15:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan