當前位置:編程學習大全網 - 源碼下載 - iexplorer窗口被隱藏,用任務管理器才能看到是什麽原因?

iexplorer窗口被隱藏,用任務管理器才能看到是什麽原因?

他使用了隱藏IE的任務欄的代碼,具體我有段源代碼,也具有這個功能Option Explicit

Private Type RECT

Left As Long

Top As Long

Right As Long

Bottom As Long

End Type

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _

(ByVal lpClassName As String, ByVal lpWindowName As String) 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 Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _

ByVal nCmdShow As Long) As Long

Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long

Private Declare Function ShowWindowAsync Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) 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 GetMenu Lib "user32" (ByVal hwnd As Long) As Long

Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, lprc As RECT) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

'Const WM_LBUTTONDOWN = &H201

'Const WM_LBUTTONUP = &H202

'定義窗口以及子窗口的類名

Const sBaseBar = "BaseBar"

Const sTrayWindow = "Shell_TrayWnd"

Const sTrayNotify = "TrayNotifyWnd"

Const sStartButton = "Button"

Const sAppSwitchBar = "ReBarWindow32"

Const sAppSwitch = "MSTaskSwWClass"

Const sAppIcon = "ToolbarWindow32"

Const sTrayClock = "TrayClockWClass"

Const sDesktopIcon = "ShellDll_DefView"

Const sProgman = "Progman"

Const WM_USER = &H400

Const TPM_NONOTIFY = &H80

Const SW_SHOW = 5

Const SW_HIDE = 0

Const SW_NORMAL = 1

Const SW_RESTORE = 9

Const SW_SHOWDEFAULT = 10

Const SW_SHOWNA = 8

Const SW_SHOWNOACTIVATE = 4

Const SWP_ASYNCWINDOWPOS = &H4000

Const HWND_TOP = 0

Const TBM_GETPOS = WM_USER

Dim wnd As Long

Private Sub chkWnd_Click(Index As Integer)

Dim i As Integer

'獲得任務欄的窗口句柄

wnd = FindWindow(sTrayWindow, vbNullString)

'Debug.Print Hex(wnd), GetMenu(wnd)

Select Case Index

Case 0

Case 1

'根據任務欄窗口句柄獲得子窗口的句柄

wnd = FindWindowEx(wnd, 0, sStartButton, vbNullString)

Case 2

wnd = FindWindowEx(wnd, 0, sTrayNotify, vbNullString)

Case 3

wnd = FindWindowEx(wnd, 0, sAppSwitchBar, vbNullString)

wnd = FindWindowEx(wnd, 0, sAppSwitch, vbNullString)

Case 4

wnd = FindWindowEx(wnd, 0, sTrayNotify, vbNullString)

wnd = FindWindowEx(wnd, 0, sTrayClock, vbNullString)

Case 5

'獲取桌面的窗口句柄

wnd = FindWindow(sProgman, vbNullString)

wnd = FindWindowEx(wnd, 0, sDesktopIcon, vbNullString)

Case 6

wnd = FindWindowEx(wnd, 0, sAppSwitchBar, vbNullString)

wnd = FindWindowEx(wnd, 0, sAppIcon, vbNullString)

Case Else

wnd = 0

End Select

If chkWnd(Index).Value = 1 Then

ShowWindow wnd, SW_HIDE

Else

ShowWindow wnd, SW_SHOW

End If

End Sub

Private Sub Command1_Click()

Dim i As Integer

'清除所有的選項並恢復所有窗口

For i = 0 To 6

chkWnd(i).Value = 0

chkWnd_Click (i)

Next i

End Sub

'Private Sub Command2_Click()

' Dim rcL As RECT

' Dim wnd As Long

'

' wnd = FindWindow(sBaseBar, vbNullString)

' Debug.Print Hex(wnd)

' 'Debug.Print TrackPopupMenu(wnd, TPM_NONOTIFY, 100, 100, 0, 0, rcL)

' Debug.Print GetMenu(wnd)

' 'Debug.Print SendMessage(wnd, TBM_GETPOS, 0, 0)

' 'GetWindowRect wnd, rcL

' 'Debug.Print SetWindowPos(wnd, HWND_TOP, 100, 200, 200, 350, SWP_ASYNCWINDOWPOS)

' 'Debug.Print wnd, rcL.Left, rcL.Right, rcL.Top, rcL.Bottom

' 'Debug.Print ShowWindowAsync(wnd, SW_SHOW)

'End Sub

Private Sub Form_Load()

chkWnd(0).Caption = "隱藏任務欄"

chkWnd(1).Caption = "隱藏開始按鈕"

chkWnd(2).Caption = "隱藏任務欄圖標"

chkWnd(3).Caption = "隱藏程序按鈕"

chkWnd(4).Caption = "隱藏任務欄時鐘"

chkWnd(5).Caption = "隱藏桌面圖標"

chkWnd(6).Caption = "隱藏快速運行圖標"

Command1.Caption = "恢復所有窗口"

End Sub

Private Sub Form_Unload(Cancel As Integer)

Command1_Click

End Sub

不知道能不能對妳所幫助,呵呵!!

  • 上一篇:如果妳在路上偶然遇到了托尼·斯塔克,妳想說些什麽?
  • 下一篇:汕頭抖音他們推薦團購的有提成是什麽軟件
  • copyright 2024編程學習大全網