zippoxer Posted November 19, 2011 Share Posted November 19, 2011 (edited) 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 November 19, 2011 by zippoxer Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 19, 2011 Share Posted November 19, 2011 You tried the latest version of SCAR? Also, afaik GetCursorInfo can only get the info inside of the windows your process owns. GetCursorType in SCAR is quite a lot more powerful, but also has it's limits. Quote Link to comment Share on other sites More sharing options...
zippoxer Posted November 19, 2011 Author Share Posted November 19, 2011 (edited) 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 November 19, 2011 by zippoxer Quote Link to comment Share on other sites More sharing options...
zippoxer Posted November 28, 2011 Author Share Posted November 28, 2011 Mmm I'm still trying to do that API call properly :\ Can anyone help me? Quote Link to comment Share on other sites More sharing options...
wundertüte Posted December 1, 2011 Share Posted December 1, 2011 does that mean it will not work if i setdesktopasclient ? Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 1, 2011 Share Posted December 1, 2011 (edited) 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 December 1, 2011 by Freddy Quote Link to comment Share on other sites More sharing options...
zippoxer Posted December 1, 2011 Author Share Posted December 1, 2011 The C++ code that I've shown as the wanted functionality works. When in a game window, it helps me decide whether the cursor is sword-like or pointer-like by returning a different number for each. Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 1, 2011 Share Posted December 1, 2011 Hmmm... So if I return the cursor handle you're ok? Quote Link to comment Share on other sites More sharing options...
zippoxer Posted December 2, 2011 Author Share Posted December 2, 2011 Yes but you don't have to since I can call Windows API to do that. I can, but don't know how. If it's a public bot that wouldn't be great, but at least working. Quote Link to comment Share on other sites More sharing options...