Sign in to follow this  
Followers 0
Helge

GUIGetCursorInfo bug ?

7 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
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}>

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

*Bump*

EDIT: If this is normal, than maybe an Optional paremeter could be used to toggle this? :(

Edited by layer

FootbaG

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks jpm !!

Share this post


Link to post
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
:(

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  
Followers 0