Target Window Functions

Freeze

function Freeze: boolean;

If you call Freeze, the data that is currently in the client is stored into memory. Simba will then target this memory for all further finding operations; until Unfreeze is called. This can dramatically increase speed if you don’t care if the image doesn’t change. It can be even more important if you don’t want the image to change; if you want to analyze a specific frame.

Use like:

Freeze;

if findcolors(...) then
  ...

Unfreeze

Make sure you never forget to call Unfreeze!

Unfreeze

function Unfreeze: boolean;

Unfreeze the client data and restore the original client. See Freeze for more details.

GetClientDimensions

procedure GetClientDimensions(var w, h:integer);

Return the size of the client in w and h. If it fails, it returns -1 for both h and w.

GetClientPosition

procedure GetClientPosition(var left, top:integer);

Return the position of the client in left and top. May return negative values.

SetTargetBitmap

function SetTargetBitmap(Bitmap : integer): integer;

Set a bitmap as target / client. (It must be loaded by Simba)

SetTargetArray

function SetTargetArray(P: Integer; w, h: integer): integer;

Set a target array as client data. This is generally not something you’d want to call yourself. It is mainly included for external components to allow Simba to efficiently target its memory. See the SMART source on how to do this.

SetEIOSTarget

function SetEIOSTarget(name: string; initargs: Variant): integer;

SetImageTarget

procedure SetImageTarget(idx: integer);

SetKeyMouseTarget

procedure SetKeyMouseTarget(idx: integer);

GetImageTarget

function GetImageTarget: integer;

GetKeyMouseTarget

function GetKeyMouseTarget: integer;

ExportImageTarget

function ExportImageTarget : TTarget_Exported;

ExportKeyMouseTarget

function ExportKeyMouseTarget : TTarget_Exported;

FreeTarget

procedure FreeTarget(idx: integer);

SetDesktopAsClient

procedure SetDesktopAsClient;

Set the default desktop as client.

ActivateClient

procedure ActivateClient;

Set the current target as active for key input.

IsTargetValid

function IsTargetValid: boolean;

Returns true if the current target is valid.

GetProcesses

function GetProcesses: TSysProcArr;

Returns processes with the title of their window, the handle of the window, the process id and their width and height.

With TSysProc being defined as:

TSysProc = record
    Title: string;
    Handle: integer;
    Pid: integer;
    Width, Height: integer;
end;

Example usage:

function FindAndSetTarget(TitlePrefix: String; SetAsTarget: Boolean): Boolean;
var
  T: TSysProcArr;
  I: Integer;
begin
  T:= GetProcesses();
  for I := 0 to high(T) do
    if StartsWith(TitlePrefix, T[i].Title) then
    begin
      Result := True;
      if SetAsTarget then
      begin
        SetTarget(T[i]);
        ActivateClient;
      end;
    end;
end;