maqleod Posted May 20, 2007 Share Posted May 20, 2007 is there a way to detect a mouse click (either secondary or middle) on a window title bar and return the window title or handle of that window? I would try using the guigetcursorinfo function, but I want it to work on windows not created by guicreate. [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
ScriptUSER Posted May 20, 2007 Share Posted May 20, 2007 is there a way to detect a mouse click (either secondary or middle) on a window title bar and return the window title or handle of that window? I would try using the guigetcursorinfo function, but I want it to work on windows not created by guicreate.this events do the job : $GUI_EVENT_MOUSEMOVE the mouse cursor has moved. $GUI_EVENT_PRIMARYDOWN the primary mouse button was pressed. $GUI_EVENT_PRIMARYUP the primary mouse button was released. $GUI_EVENT_SECONDARYDOWN the secondary mouse button was pressed. see help file for examples Link to comment Share on other sites More sharing options...
PaulIA Posted May 20, 2007 Share Posted May 20, 2007 (edited) this events do the job : $GUI_EVENT_MOUSEMOVE the mouse cursor has moved. $GUI_EVENT_PRIMARYDOWN the primary mouse button was pressed. $GUI_EVENT_PRIMARYUP the primary mouse button was released. $GUI_EVENT_SECONDARYDOWN the secondary mouse button was pressed. see help file for examplesWell, not really. He wants to click on the caption bar and when you do that, you don't get the mouse message from AutoIt. Try the script below and click on the caption: #include <GUIConstants.au3> $hGUI = GUICreate("Test", 400, 300) GUISetState() while 1 Switch GUIGetMsg() case $GUI_EVENT_PRIMARYDOWN ConsoleWrite("Primary down" & @CR) case $GUI_EVENT_CLOSE Exit EndSwitch wend What you need to do is capture the WM_NCHITTEST message. It will give you the mouse information that you need, even if the mouse is in the non client (hence the NC part) of the window. @magleod: Give this a try and if you need help, give me a PM and I'll give you a hand. Edit: Actually you need to look for the WM_NCLBUTTONDOWN message to capture a click in the caption. Edited May 20, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now