Jump to content

Gui* functions just for user created Guis?

Recommended Posts

I would really like to use GUIGetMsg() on a window I did not create.

Is that possible? I don't see a place where you can pass a handle or wintitle.

Below is my pitiful attempt to change the help example to do this. It would be great if I could pass in the handle to the current window but maybe I'm dreaming.


#include <GUIConstants.au3>

Opt("GUICoordMode", 1)

; GUIStartGroup()

; Show the GUI

GUISetState ()

While 1

$msg = GUIGetMsg()


Case $msg = 0

FileWriteLine("test.txt","No Event")

;MsgBox(0, "", "No Event")

; Exit ; exits app

Case $msg = $GUI_EVENT_CLOSE

FileWriteLine("test.txt","Dialog was closed")

; MsgBox(0, "", "Dialog was closed")



FileWriteLine("test.txt","Dialog minimized")

; MsgBox(0,"", "Dialog minimized",2)


FileWriteLine("test.txt","Dialog restored")

; MsgBox(0,"", "Dialog restored",2)

Case $msg = $button_1

FileWriteLine("test.txt","Radio " & $radioval1)

; MsgBox(0, "Default button clicked", "Radio " & $radioval1 )

Case $msg >= $radio_1 AND $msg <= $radio_3

$radioval1 = $msg - $radio_1



Is it also the case that all of the GUI functions are for creating user Guis?

Assuming the above is true is the another good way to do something like GUIgetMsg() on any window? So I can look at any window and see the events?

Thanks again

Link to comment
Share on other sites

GuiGetMsg will only work on your AutoIT created window. There are lots of Gui functions in the help though that will work on windows/controls external to your autoit script. But getting messages intended for another window is not so easy.

Search the forums for SetWindowsHookEx. The MouseSetOnEvent_UDF, is probably a good starting point.

Make sure you read the MSDN documentation for SetWindowsHookEx.

If you just want to see the messages in another window to get familiar with what's happening, try Winspector

Link to comment
Share on other sites

I was looking at _MouseSetOnEvent() UDF which looks really cool.

But is that just for catching other events and setting the mouse?

Something that catches events is what I am looking for.

I see the event handler in the UDF is that what I need to model (I don't understand exactly what is happening there) or should I be looking at something else?

Also, Gary (or anyone else) where do I find the beta? Can I use a beta just like the normal verison of AutoIT or are there differences besides new functions.

Thanks again

Edited by maestro1024
Link to comment
Share on other sites

I see the beta now but _WinAPI_SetWindowsHookEx does not have a mouse example.

Would I get the mouse event and case off of that? How would I know what type of events to look for?

Also I think this is a limited solution to what I am looking for (maybe it is not I am still trying to figure this all out).

With the getmsg for user created guis I think you can get most any message is this possible with hooks?

Also looking at the msdn article I wasn't clear how the VB in that relates to Autoit. Do you have to translate the commands and use an equivalent command or is there a way to do that natively in autoit?

Thanks again

Link to comment
Share on other sites

Thanks again for all the help. I think I still need some help on how to pursue this.

I looked some at the MSDN and that is great information but what are the examples there written in? Do I need to translate that somehow to Autoit? Or would you have to get the source for autoit and pass this functions up to the autoit script (which is what I guess is in the beta version).

I guess the beta version is what I have to use I am just not sure what the steps are to get the messages from any active window. Do I create a global hook? and the case off of the returns?

Will the global hook be able to get the messages from any window? I don't have to know exactly what process or dll was called?

Link to comment
Share on other sites

Can DllCallbackRegister and DllCallbackGetPtr be used to get just the events on a current window? I don't see the events coming through in the example but it looks like that would be the place.

I saw this


Which I can definately use to know if someone right clicks. If I want to know if the user click inside the active window would I have to compare the cordinates of the window versus where the user clicked or is there a better way?

Thanks again

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

  • Recently Browsing   0 members

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