本帖最后由 pusofalse 于 2010-1-27 07:29 编辑 #include <WinAPI.au3>
#include <GUIToolbar.au3>
Local $tBuffer, $pBuffer, $iProcessId, $hWnd, $iCmdId, $sText
Local $pParam, $iBytesRead, $hProcess, $hWndOwner, $sResult, $hP
$tBuffer = DllStructCreate("hWnd Window")
$pBuffer = DllStructGetPtr($tBuffer)
$hWnd = ControlGetHandle("[class:Shell_TrayWnd]", "", "ToolbarWindow322")
$hProcess = _WinAPI_OpenProcess(0x1F01FF, 0, ProcessExists("Explorer.exe"))
For $i = 0 To _GUICtrlToolbar_ButtonCount($hWnd) - 1
$iCmdId = _GUICtrlToolbar_IndexToCommand($hWnd, $i)
$sText = _GUICtrlToolbar_GetButtonText($hWnd, $iCmdId)
$pParam = _GUICtrlToolbar_GetButtonParam($hWnd, $iCmdId)
_WinAPI_ReadProcessMemory($hProcess, Ptr($pParam), $pBuffer, 4, $iBytesRead)
$hWndOwner = DllStructGetData($tBuffer, "Window")
If $hWndOwner = 0 Then
$sResult &= "Class: " & $sText & @CRLF
Else
_WinAPI_GetWindowThreadProcessId($hWndOwner, $iProcessId)
$sResult &= "Window Owner: " & $hWndOwner & @CRLF
$sResult &= "Process ID: " & $iProcessId & @CRLF
$sResult &= "Title: " & $sText & @CRLF
; $sResult &= "Command Line: " & _QueryProcessCommandLine($iProcessId) & @CRLF
$sResult &= @CRLF
EndIf
Next
_WinAPI_CloseHandle($hProcess)
Msgbox(0, $hWnd, $sResult)
|