GetCursorInfo has different Results Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Guest123

GetCursorInfo has different Results

28 Apr 2017, 01:46

When using the following code, I have on different machines (both Windows7 64bit) different thiscursors:
As an example for A_Cursor=Arrow (standard arrow) shown on both machines correct, i get on one machine thiscursor=65541, while the other shows thiscursor=65539
Does anyone has an idea why? How to make to behave same?

Code: Select all

#persistent

Settimer c, 500
return	

c:
  thiscursor:=QueryMouseCursor()
  Tooltip, thiscursor=%thiscursor%`nA_Cursor=%A_Cursor%
return

QueryMouseCursor()
{
	NumPut(VarSetCapacity(CurrentCursorStruct, A_PtrSize + 16), CurrentCursorStruct, "uInt")
	DllCall("GetCursorInfo", "ptr", &CurrentCursorStruct)
	return (numP:=NumGet(CurrentCursorStruct,  8))
}
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: GetCursorInfo has different Results

28 Apr 2017, 03:22

The number you get is a handle, not a constant identifier. What exactly are you trying to do?
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: GetCursorInfo has different Results

28 Apr 2017, 04:07

Code: Select all

65539  -> NORMAL
65541  -> INSERT
65543  -> WAIT
65545  -> CROSS
65547  -> UP
65549  -> RESIZE_NW_SE
65551  -> RESIZE_NE_SW
65553  -> RESIZE_EW
65555  -> RESIZE_NS
65557  -> MOVE
65559  -> NOT_ALLOWED
65561  -> PROGRESS
65563  -> HELP
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Guest123

Re: GetCursorInfo has different Results

28 Apr 2017, 05:01

Want to check the cursor changes to Standard Cursor. But as I had problems a made this small script. So I expected that always 65539 (Normal) for Standard Cursor appears. What I don't understand why on a other system the for Standard cursor 65541 returns, which is normally Insertcursor (making my script not working). Checked the Mouse-systemcontrol, it is identical on both system.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: GetCursorInfo has different Results  Topic is solved

28 Apr 2017, 05:12

@ jNizM, as indicated by the the first post, you cannot rely on those numbers being constant identifiers, and I've seen no documentation suggesting you can, did you?
@Guest123, you can get the handles to the usual cursors with the LoadCursor function, passing the IDC_* constants, and then compare them to the handle you get from GetCursorInfo (or GetCursor). I still wonder what the goal is though.

Cheers.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: GetCursorInfo has different Results

28 Apr 2017, 05:13

Guest123 wrote:Want to check the cursor changes to Standard Cursor. But as I had problems a made this small script. So I expected that always 65539 (Normal) for Standard Cursor appears. What I don't understand why on a other system the for Standard cursor 65541 returns, which is normally Insertcursor (making my script not working). Checked the Mouse-systemcontrol, it is identical on both system.
So why not use A_Cursor?
Guest123

Re: GetCursorInfo has different Results

28 Apr 2017, 05:47

@Helgef: Thanks a lot, that was it! I wanted to understand why GetCursorInfo differs on different systems (Surely I could use also A_CURSOR). I found exactly the constants of jNizM which were not working on my machine.
just me
Posts: 9492
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: GetCursorInfo has different Results

28 Apr 2017, 10:30

Helgef wrote:@Guest123, you can get the handles to the usual cursors with the LoadCursor function, passing the IDC_* constants, and then compare them to the handle you get from GetCursorInfo (or GetCursor).
That's exactly what AHK does when populating A_Cursor.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: popdeg, Spawnova and 158 guests