Jump to content

how to get Tray data of a particular app?


Recommended Posts

I am currently using this code to fetch all toolbar/tray data scanning for 

#include <GuiToolBar.au3>
func _GetCPU()
    local static $instance = 1
    local static $CPU = ""
        while TRUE
            local $handle = ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "[CLASS:ToolbarWindow32;INSTANCE:" & $instance & "]")
            if $handle > 0 then
                for $i = 1 to _GUICtrlToolbar_ButtonCount($handle)
                    $CPU = _GUICtrlToolbar_GetButtonText($handle, _GUICtrlToolbar_IndexToCommand($handle, $i))
                    if StringInStr($CPU, "CPU") then
                        $CPU = StringRegExpReplace($CPU, "(?s)(CPU.*?C)(.+)", "$1")
                        $CPU = StringRegExpReplace($CPU,"\s+","")
                        return $CPU
                    endif
                next
                $instance += 1
            else
                $instance = 1
                $CPU = ""
                return $CPU
            endif
        wend
    return $CPU
endfunc

 

 

I soon realize, I was pooling potentially all tray/toolbars and the above is sometimes inaccurate.

example: The above code was suppose to scan the tray/toolbars of "ThrottleStop.exe" for the CPU temperature.

However, other apps that has "CPU" in their tray/toolbars will get scanned instead.

How do I get the tray/toolbars of a specific PID?

 

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...