Jump to content

GUIGetCursorInfo bug ?


Recommended Posts

I'm currently working on a project, where I'm using GUIGetCursorInfo() to

check for a mouseclick. So while I was bug-testing this project of mine today,

I found out that GUIGetCursorInfo() acts the same as when the GUI is active

and when it ain't. This, of course, isn't what I want as it gives strange results.

This even occurs when specifying the window-handle, which got me thinking

that there might be bug with GUIGetCursorInfo(). See the example below :

#include <GUIConstants.au3>
Opt("WinTitleMatchMode",4)

$wHandle = GUICreate("Test : GGCI on inactive GUI",400,400)
$cButton = GUICtrlCreateButton("Click area...Minimize and click..",10,10,380,380)
GUISetState()

While GUIGetMsg() <> $GUI_EVENT_CLOSE
    $curInfo = GUIGetCursorInfo($wHandle)
    
    If $curInfo[2] AND $curInfo[4] = $cButton Then
        If WinActive("handle=" & $wHandle) Then
            MsgBox(64,"","Minimize...and THEN click.")
        Else
            MsgBox(64,"","You clicked.")
        EndIf
    EndIf   
WEnd
Link to comment
Share on other sites

Yes, you're correct.

It works normally when it is minimized, however if you make the

GUI inactive by opening another window (like you said), it acts

strange again. Is it supposed to be like this, or is it a bug ? :(

Well, when it's minimized it seems to work normally...

But, I did notice, that when I had this window (Internet Explorer) over top of the GUI window, and clicked where the button WOULD be, I got the message box.

<{POST_SNAPBACK}>

Link to comment
Share on other sites

Yes, you're correct.

It works normally when it is minimized, however if you make the

GUI inactive by opening another window (like you said), it acts

strange again. Is it supposed to be like this, or is it a bug ?  :(

<{POST_SNAPBACK}>

Jon design this function, so I am not sure if he really want to return info when the gui is not active.

I will add some checking to return info only if the GUI is active when no winhandle is given.

Link to comment
Share on other sites

Thanks jpm !!

<{POST_SNAPBACK}>

Your script will have to check @error before using the GUIGetCursorInfo because no array will be returned
If @error = 0 AND $curInfo[2] AND $curInfo[4] = $cButton Then
:(
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...