请教一下关于任务栏的问题
请问一下高手们有什么方法能获取到任务栏上的任务??? 这个问题太高深啦....看不懂 ”任务栏上的任务“是指什么,最小化的窗体,还是任务托盘的图标前面一种情况,应该可以用winlist获得,后面一种情况,好像见过,印象不深了,要翻翻了 ”任务栏上的任务“是指什么,最小化的窗体,还是任务托盘的图标
前面一种情况,应该可以用winlist获得,后 ...
netegg 发表于 2010-1-26 17:15 http://www.autoitx.com/images/common/back.gif
后面一种情况我只能获取到未隐藏的,隐藏的暂时没思路... 本帖最后由 netegg 于 2010-1-26 19:05 编辑
回复 4# sanmoking
api里有一个枚举任务栏图标的,忘了,下面这段是刷新
; ===================================================================
; _RefreshSystemTray($nDealy = 1000)
;
; Removes any dead icons from the notification area.
; Parameters:
; $nDelay - IN/OPTIONAL - The delay to wait for the notification area to expand with Windows XP's
; "Hide Inactive Icons" feature (In milliseconds).
; Returns:
; Sets @error on failure:
; 1 - Tray couldn't be found.
; 2 - DllCall error.
; ===================================================================
Func _RefreshSystemTray($nDelay = 1000)
; Save Opt settings
Local $oldMatchMode = Opt("WinTitleMatchMode", 4)
Local $oldChildMode = Opt("WinSearchChildren", 1)
Local $error = 0
Do; Pseudo loop
Local $hWnd = WinGetHandle("classname=TrayNotifyWnd")
If @error Then
$error = 1
ExitLoop
EndIf
Local $hControl = ControlGetHandle($hWnd, "", "Button1")
; We're on XP and the Hide Inactive Icons button is there, so expand it
If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
ControlClick($hWnd, "", $hControl)
Sleep($nDelay)
EndIf
Local $posStart = MouseGetPos()
Local $posWin = WinGetPos($hWnd)
Local $y = $posWin
While $y < $posWin + $posWin
Local $x = $posWin
While $x < $posWin + $posWin
DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y)
If @error Then
$error = 2
ExitLoop 3; Jump out of While/While/Do
EndIf
$x = $x + 8
WEnd
$y = $y + 8
WEnd
DllCall("user32.dll", "int", "SetCursorPos", "int", $posStart, "int", $posStart)
; We're on XP so we need to hide the inactive icons again.
If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
ControlClick($hWnd, "", $hControl)
EndIf
Until 1
; Restore Opt settings
Opt("WinTitleMatchMode", $oldMatchMode)
Opt("WinSearchChildren", $oldChildMode)
SetError($error)
EndFunc; _RefreshSystemTray() 本帖最后由 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("", "", "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) pusofalse大,用你上面的代码能不能解决上次我问的关于加了POPUP样式的GUI的任务栏问题哈? 本帖最后由 pusofalse 于 2010-1-27 07:41 编辑
回复 7# llztt
看错。。。 - -|||
不能解决,这个只是获取任务栏上的任务的,与那个没有关系的~
页:
[1]