The issue I am seeing is running a disabled check on a button in my application. Unfortunately our team believes the best way to check the code we have to work with is to check the pointer-event, which remains: none. I am struggling to locate the cursor object whether inside Sys.Browser, Sys.Window, WndObjcect.
I have found the cursor documentation but I am unsure how to get the ‘*componentObj’*needed for the property check. I also see tObjectPicker and have name mapped the object I hover the mouse over, but the properties pickedObjectName and cursor return failures in my script.
First, I’m not 100% sure what you are trying to accomplish, so sorry if my response is off target.
Years ago I dabbled with identifying the current cursor type (e.g. Arrow, Move, Etc.) and ended up using the Win32API. I was semi-successful accomplishing what I had in mind, but eventually took a different approach.
The below code (VBScript) shows what I did to get the cursor object. I passed this Function the application window object and got back the cursor object.
I can’t recall if that ended up working as I intended. I think I was on the right path with the Win32API though.
Function getCurrentCursor(wndObj)
Dim pid, tid, crsr
pid = Win32API.GetWindowThreadProcessId(wndObj.Handle, Nothing)
tid = Win32API.GetCurrentThreadId
Call Win32API.AttachThreadInput(pid, tid, True)
crsr = Win32API.GetCursor
Call Win32API.AttachThreadInput(pid, tid, False)
getCurrentCursor = crsr
End Function
var form = UserForms.SampleForm;
var button = form.buttonOK;
// Moves the cursor to the button center
button.MouseMove();
//Returns the cursor type
var currentCursor = button.Cursor;
Log.Message("Cursor type: " + currentCursor);
This code reads the current cursor type and logs it. The value returned will be one of the cr* constants (like crDefault, crHandPoint, etc.).
… If you find my posts helpful drop me a like! Be sure to mark or post the solution to help others out and/or to credit the one who helped you.
What test are you trying to perform - verifying that the button is disabled? Or verifying that the cursor has changed upon hovering over the disabled button? Or verifying that the button can not be moved?
You mentioned “TObjectPicker”, is your application developed using Delphi?
Originally posted by Hassan_Ballan on July 13, 2025
TestComplete provides access to the cursor object via Sys.Desktop.Cursor, which allows you to identify the current mouse cursor shape by analyzing the cursor handle.
function GetCursorHandle() {
var cursor = Sys.Desktop.Cursor;
Log.Message("Cursor Handle: " + cursor.Handle);
}
You may also need to run Cursor.ToString() to save those handle values.
If a response helped you out, don’t forget to Like it! And if it answered your question, mark it as the solution so others can benefit too.
Do any of the solutions, provided by everyone here, help with what you are trying to build? If not, could you further elaborate on the scenario you are trying to accomplish with TestComplete?