Jump to content

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


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...