Jump to content
Sign in to follow this  

Troubles Re-Enabling Controls

Recommended Posts



I got some troubles using ControlDisable and ControlEnable.

I found a script on the Internet to determine the Windows and Control Handle which is located under your mouse cursor. I modified the Function "enable" to initially disable all the Controls in the dialog whether to save or not save the changes done to a text document which works fine for me. I changed the function ControlDisable to ControlEnable and ran the script again to manually re-enable the initially disabled controls... but nothing happens at all! The Control Handle changed from 0x0033079A to 0x0020040C in the process when i check it in the tray tip but the autoit window info tool still shows the correct Control Handle which was originally used to disable the control. I can also use the manually entered (old) Control Handle to re-enable the control so the script detecting the Control Handle seems to be broken :(

Could you please tell me where the bug is hidden so I can make it run as intended?

#include <WinAPI.au3>
#include <Misc.au3>
 hotkeyset("{F1}", "enable")

Func _WindowFromPoint($iX,$iY)
    Local $stInt64,$aRet,$stPoint=DllStructCreate("long;long")
    If @error Then Return SetError(2,@error,0)
    If $aRet[0]=0 Then Return SetError(3,0,0)
    Return $aRet[0]

Local $hControl, $hWin, $hOldWin, $aMousePos
$hOldWin = ""
While sleep(100)

func enable()
    $aMousePos = MouseGetPos()
    ; Since _WindowFromPoint() can return 'sub' windows, or control handles, we should seek the owner window
    Controlenable($hWin, "", $hControl)
    traytip("", $hWin&@crlf&$hControl, 1)


Many Thanks in Advance!

Share this post

Link to post
Share on other sites

You can't with WindowFromPoint function:


The WindowFromPoint function does not retrieve a handle to a hidden or disabled window, even if the point is within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search.

Maybe there are other ways like "AutoIt Window Info" does but i dunno

Nothing is so strong as gentleness. Nothing is so gentle as real strength


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this