Jump to content

MouseGetCursor Problem

Recommended Posts

This is a simple script that allows me to automatically get focus of an edit frame in the application CPR. (Who ever coded CPR is an idiot but that's another story).

Anyway, my little script works great. When the mouse is moved over the frame, the cursor changes into the Ibar shape and the frame becomes active and focused.

Unfortunately, a side effect is that double clicking with the left mouse button becomes disabled, not just in CPR but in all other window programs, including desktop icons. Why does this happen? Is there a cure?

Thanks in advance for any thoughts.

AutoItSetOption ( "WinTitleMatchMode", 2 )

$cursor=5 ;Ibar cursor shape

While 1

Sleep (50)

If MouseGetCursor()=$cursor And WinActive ("CPR", "LOCAL TITLE") Then Call ("Ibar1")

If MouseGetCursor()<>5 Then $cursor = 5


Func Ibar1()

$cursor = not $cursor

ControlFocus("CPRS", "", "TRichEdit1")


Link to comment
Share on other sites

How about this. I could only test it with Scite, but it should work with your app too:

AutoItSetOption ( "WinTitleMatchMode", -4 )

$wintitle = "CPR"
$wintext = "LOCAL TITLE"
$editctrl = "TRichEdit1"

;~ $wintitle = "classname=SciTEWindow"
;~ $wintext = ""
;~ $editctrl = "Scintilla1"

While 1
    Sleep (100)
    If MouseGetCursor()=5 then
        if WinActive ($wintitle, $wintext) Then
            $hEdit = ControlGetHandle($wintitle, $wintext, $editctrl)
            $hFocus = ControlGetHandle($wintitle, $wintext,ControlGetFocus($wintitle, $wintext))
            if $hEdit <> $hFocus then
                ControlFocus($wintitle, $wintext, $editctrl)

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

  • 1 year later...

I also suffer this unusual bug.

It seems after I have a vbscript call the MouseGetCursor function from an instance of autoit com object it makes the doubleclick misbehave system wide.

Can no longer maximise windows, or double click icons. However some double clicks continue to work, for example I can double click a line of code in notepad++ and it selects as expected.

Is there any solution or idea yet on how to fix this?

Once the script exits the function returns to normal.

Setting the object to nothing isn't sufficient to emulate an 'unloading' of the autoit object (as an idea I tried)....

Any other ideas?

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Anyone? A solution? this is a crippling bug.

I have the same problem, but I for me it only caused a problem when my script was not active. For example, I could not double click My Computer to open up explorer. I was able to solve my problem quite easily by having something like this

If WinACtive($MyGui) then;only check if my script is active
 ;start loop where I want to check cursor
  $Cursortype = MouseGetCursor()

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...