Hi Beom,
Long time ago the following code was posted by Support. Hope it will help.
================================
If you know the coordinates, where the rectangle should be drawn, you can draw a rectangle on the screen and save the screen to Log. Here is an example:
[DelphiScript]
const
LineWidth = 3;
procedure DrawAndSave(Left, Top, Width, Height);
var hdcScreen, hPen1, hOldPen1, hBrush1, hOldBrush1;
begin
hdcScreen := CreateDC('DISPLAY', nil, nil, nil);
hPen1 := CreatePen(PS_SOLID, 1, clRed);
hOldPen1 := SelectObject(hdcScreen, hPen1);
hBrush1 := CreateSolidBrush(clRed);
hOldBrush1 := SelectObject(hdcScreen, hBrush1);
Rectangle(hdcScreen, Left - LineWidth,
Top, Left + Width + LineWidth, Top - LineWidth);
Rectangle(hdcScreen, Left + Width,
Top - LineWidth, Left + Width + LineWidth, Top + Height + LineWidth);
Rectangle(hdcScreen, Left + Width + LineWidth, Top + Height,
Left, Top + Height + LineWidth);
Rectangle(hdcScreen, Left, Top + Height + LineWidth,
Left - LineWidth, Top - LineWidth);
Log.Picture(Sys.Screen, 'Picture');
SelectObject(hdcScreen, hOldPen1);
DeleteObject(hPen1);
SelectObject(hdcScreen, hOldBrush1);
DeleteObject(hBrush1);
DeleteDC(hdcScreen);
end;
procedure RefreshScreen;
var
TUser32, User32: OleVariant;
begin
TUser32 := DLL.DefineDLL('user32');
TUser32.DefineProc('InvalidateRect', vt_int, vt_int, vt_int, vt_bool);
User32 := DLL.Load('user32');
User32.InvalidateRect(0,0,0);
end;
procedure Main;
var p, w, obj: OleVariant;
x, y: OleVariant;
begin
p := Sys.Process('notepad');
w := p.Window('Notepad', '*');
w.Activate;
obj := w.Window('Edit');
x := obj.Left;
y := obj.Top;
w.ClientToScreen(x, y);
DrawAndSave(x, y, obj.Width, obj.Height);
RefreshScreen();
end;
For more information on the Win32API functions, please see Win32API Plug-In help topic and the corresponding samples.
Bobby Edgar
AutomatedQA
================================