Jump to content
Sign in to follow this  
Marc

[Solved] Change background color of edit control in another program

Recommended Posts

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 by Marc

It's my job to comfort the disturbed and to disturb the comfortable.
My Projects: Profiler, MakeSFX, UserInfo, Simple Robocopy Progressbar

Share this post


Link to post
Share on other sites

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.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

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)

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...