Jump to content
Sign in to follow this  
daddydave

How do I get messages from multiple non-AutoIt windows?

Recommended Posts

daddydave

I want to get messages from any visible window: regardless of whether it is created by my program. Here is what I am trying, none of my debug output is showing. What do you suggest?

#include <GUIConstants.au3>
#include <Debug.au3>
Opt("MustDeclareVars", 1)

Global $var[100]

Global $hWnd, $msg, $i

$var = WinList()

_DebugSetup ("What's going on?")

While 1
    For $i = 1 To $var[0][0]
        If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
            $hWnd = $var[$i][1]
            GUISwitch($hWnd)
            $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    _DebugOut("Closed")
                Case $msg = $GUI_EVENT_MINIMIZE
                    _DebugOut("Minimized")
                Case $msg = $GUI_EVENT_MAXIMIZE
                    _DebugOut("Maximized")
            EndSelect
        EndIf
    Next
WEnd

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf

EndFunc   ;==>IsVisible

Share this post


Link to post
Share on other sites
daddydave

Thanks for the fast reply, Zedna, that example looks like good stuff!

Share this post


Link to post
Share on other sites
daddydave

It turns out I don't need to monitor messages per se. I found a nice example very similar to what I want to do:

http://www.autoitscript.com/forum/index.ph...mp;#entry161762

_GuiTarget from the AnyGUI link you gave uses some of the API functions used by the example above, but it took me a while to find it.

So thanks again!

:)

Edited by daddydave

Share this post


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
Sign in to follow this  

×