Jump to content

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


Go to solution Solved by LarryDalooza,

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

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to post
Share on other sites

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)

Link to post
Share on other sites
  • Solution

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

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...