# Need to verify cursor state on disabled button

**URL:** <https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396>\
**Category:** TestComplete\
**Tags:** test, testcomplete, migrated\
**Created:** [July 9, 2025, 9:04pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396 "2025-07-09T21:04:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 9, 2025, 9:04pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/1 "2025-07-09T21:04:05Z")

</div>

> Originally posted by **vladd1** on July 09, 2025

Thank you for whoever helps to start,

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.

I am working in circles it seems, please help.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 9, 2025, 9:42pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/2 "2025-07-09T21:42:58Z")

</div>

> Originally posted by **JDR2500** on July 09, 2025

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.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 9, 2025, 10:23pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/3 "2025-07-09T22:23:06Z")

</div>

> Originally posted by **scot1967** on July 09, 2025

Hello vladd1,

I _think_ I know what you are struggling with.

You may have this doc which explains settings the various cursor states…  
[https://support.smartbear.com/testcomplete/docs/reference/user-forms/properties/cursor.html](https://support.smartbear.com/testcomplete/docs/reference/user-forms/properties/cursor.html)

The button likely has a .cursor property however.

 ![](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/f5f029fbf8f4d48b30cb874643657a46a6dfe079.png)

```auto
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. 😎

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 9, 2025, 10:29pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/4 "2025-07-09T22:29:18Z")

</div>

> Originally posted by **Hassan\_Ballan** on July 09, 2025

I assume you are trying to validate the cursor as a work around to finding button state. If I understand it correctly your goal is to check if your application button is disabled and I suggest you have a read [https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/onscreen/enabled-property-onscreen-object.html](https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/onscreen/enabled-property-onscreen-object.html)

💬 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.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 10, 2025, 8:29am UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/5 "2025-07-10T08:29:28Z")

</div>

> Originally posted by **rraghvani** on July 10, 2025

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?

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 13, 2025, 7:45pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/6 "2025-07-13T19:45:39Z")

</div>

> 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**.

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 14, 2025, 12:34pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/7 "2025-07-14T12:34:48Z")

</div>

> Originally posted by **scot1967** on July 14, 2025

Yeah, this could likely be be found at the app level as well. Simpler if that action isn’t specially tied to the button object. Nice.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [July 14, 2025, 4:59pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/8 "2025-07-14T16:59:10Z")

</div>

> Originally posted by **sean4311** on July 14, 2025

Hi vladd1​!

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [October 7, 2026, 5:16pm UTC](https://community.smartbear.com/t/need-to-verify-cursor-state-on-disabled-button/396/9 "2026-10-07T17:16:48Z")

</div>

Closed on October 7, 2026, 5:16pm UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
