Jump to content
zippoxer

Getting cursor type when it's special

Recommended Posts

I need to get my cursor type when it's inside a game. I turned to GetCursorType but it returns 0 which means cbNone if I'm right.

Later, I realized I need this functionality in SCAR:

CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
if(GetCursorInfo(&ci))
 cout << ci.hCursor << endl;
else
 cout << "SHIT" << endl;

 

Choiceless, I enabled API calls and tried this:

program New;


type
 TCursorInfo = record
   cbSize, flags, hCursor: Integer;
   ptScreenPos: TPoint;
 end;


function GetCursorInfo(c: TCursorInfo): LongBool; external 'GetCursorInfo@user32.dll stdcall';


var
 cursorInfo: TCursorInfo;


begin
 cursorInfo.cbSize := SizeOf(cursorInfo);
 if GetCursorInfo(cursorInfo) then
   WriteLn(cursorInfo.hCursor)
 else
   WriteLn('SHIT');
end.

And failed since it always prints 0.

What did I miss?

 

If I can get the same functionality without calling Windows API, please note me ;)

Edited by zippoxer
Link to comment
Share on other sites

Using GetCursorInfo I could get the cursor handle when it was in another process's window, also:

"To get information on the global cursor, even if it is not owned by the current thread, use GetCursorInfo." - http://msdn.microsoft.com/en-us/library/ms648388(v=VS.85).aspx

I'm using SCAR 3.29 Final (always using the latest stable ;)). GetCursorType can return only the standard cursor types (as far as I understand), so that's not what I'm looking for.

I'm still trying to get the cursor handle using GetCursorInfo in SCAR, but getting a zero no matter what.

 

Edit: You probably confused with GetCursor and GetCursorInfo, GetCursor is limited to the current thread.

Edited by zippoxer
Link to comment
Share on other sites

I did not confuse them, GetCursorInfo won't work. Getting the cursor type involves a whole process of attaching the target thread and such, I can add another function to get you the cursor handle, I didn't do this previously though because the old version also returns a TCursor. I'd add a GetCursorTypeEx.

 

---

 

does that mean it will not work if i setdesktopasclient ?

 

The function in SCAR will work for that just fine, it's independant from the client system.

Edited by Freddy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...