找回密码
 加入
搜索
查看: 2070|回复: 7

请教一下关于任务栏的问题

  [复制链接]
发表于 2010-1-25 20:42:36 | 显示全部楼层 |阅读模式
请问一下高手们有什么方法能获取到任务栏上的任务???
发表于 2010-1-26 09:17:59 | 显示全部楼层
这个问题太高深啦....看不懂
发表于 2010-1-26 17:15:10 | 显示全部楼层
”任务栏上的任务“是指什么,最小化的窗体,还是任务托盘的图标
前面一种情况,应该可以用winlist获得,后面一种情况,好像见过,印象不深了,要翻翻了
发表于 2010-1-26 17:28:25 | 显示全部楼层
”任务栏上的任务“是指什么,最小化的窗体,还是任务托盘的图标
前面一种情况,应该可以用winlist获得,后 ...
netegg 发表于 2010-1-26 17:15



    后面一种情况我只能获取到未隐藏的,隐藏的暂时没思路...
发表于 2010-1-26 18:40:12 | 显示全部楼层
本帖最后由 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[1]
        While $y < $posWin[3] + $posWin[1]
            Local $x = $posWin[0]
            While $x < $posWin[2] + $posWin[0]
                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[0], "int", $posStart[1])
    ; 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()
发表于 2010-1-27 06:22:50 | 显示全部楼层
本帖最后由 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)
发表于 2010-1-27 07:10:20 | 显示全部楼层
pusofalse大,用你上面的代码能不能解决上次我问的关于加了POPUP样式的GUI的任务栏问题哈?
发表于 2010-1-27 07:34:37 | 显示全部楼层
本帖最后由 pusofalse 于 2010-1-27 07:41 编辑

回复 7# llztt


看错。。。 - -|||
不能解决,这个只是获取任务栏上的任务的,与那个没有关系的~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 05:46 , Processed in 0.143398 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表