Marc Posted February 1, 2013 Posted February 1, 2013 (edited) Hi all, I am using a DB2 client which displays several values in roundabout 20 edit controls. My script reads some of the values and deletes them under certain conditions. So far, everything is fine. But to make the changes more visible to the user, I'd like to highlight the edit controls which have their content erased. My approach was like this: #include <WinAPI.au3> $title = "Form1" $handle = ControlGetHandle($title, "", "Edit1") $result = _WinAPI_SetBkColor($handle, 0xffff00) ConsoleWrite($result) Getting the handle seems to work, at least I get a hex number as a result. But the result of SetBkColor is -1 that means "failed". Any ideas? Best regards, Marc Edited February 5, 2013 by Marc Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)
LarryDalooza Posted February 1, 2013 Posted February 1, 2013 From what I can tell, you cannot change the color without subclassing the dialog msgs. SetBkColor, even if it worked, would only change the text color. AutoIt has helped make me wealthy
LarryDalooza Posted February 1, 2013 Posted February 1, 2013 You could get the position of the controls and "draw" an edge around the control to highlight it... like "AU3Info" does. Lar. AutoIt has helped make me wealthy
Marc Posted February 1, 2013 Author Posted February 1, 2013 Hi Larry, thats perhaps a stupid question, but how does au3info do that? I thought I had bookmarked a script which does something similar but I can't find it for my life best regards, Marc Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)
Solution LarryDalooza Posted February 1, 2013 Solution Posted February 1, 2013 Circles button on run dialog... no error checking... #include $rect = DllStructCreate("int;int;int;int") Send("#r") WinWait("Run") $hParent = WinGetHandle("Run") $DC = _WinAPI_GetDC($hParent) $pos = ControlGetPos($hParent,"","Button2") DllStructSetData($rect, 1, $pos[0]) DllStructSetData($rect, 2, $pos[1]) DllStructSetData($rect, 3, $pos[0] + $pos[2]) DllStructSetData($rect, 4, $pos[1] + $pos[3]) $brush = _WinAPI_CreateSolidBrush(0x0000ff) _WinAPI_FrameRect($DC, DllStructGetPtr($rect), $brush) Sleep(5000) _WinAPI_InvalidateRect($hParent) _WinAPI_DeleteObject($brush) _WinAPI_ReleaseDC(0, $DC) AutoIt has helped make me wealthy
Marc Posted February 1, 2013 Author Posted February 1, 2013 Cool, that helps me a lot! Many thanks Marc Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now