Jump to content
Sign in to follow this  
maqleod

onclick mouse event

Recommended Posts

maqleod

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

Share this post


Link to post
Share on other sites
ScriptUSER

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

Share this post


Link to post
Share on other sites
PaulIA

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

Well, 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 by PaulIA

Auto3Lib: A library of over 1200 functions for AutoIt

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  

×