SRL Archive - Suggestions

scar find client control functions


StevenV

2012-01-06 14:30:35

I'm use simba for some non-RS scripts,
scripting in simba is more pleasant than scripting in scar,
but i'm in need of the following functions,
i tried but they don't work in simba,
maybe it would be an idea to add them to simba?

procedure FindWindow(Title: string);
Finds Client window with specified title. Character case of Title must match that in window title exactly.

function FindWindowTitlePart(Title: string; CaseSensitive: Boolean): Boolean;
Finds window that contains text specified by Title parameter in window caption.

function FindWindowBySize(Width, Height: Integer): Boolean;
Finds window with specified size.

function GetClientWindowHandle: Integer;
Get Windows handle value of active client window.

procedure SetClientWindowHandle(H: Integer);
Set active client window to handle H.

Brandon

2012-01-06 14:49:24

Aren't u the lucky needy for today..

For use in Extensions/plugins..


//Declarations..

function FindWindow(ClassName, WindowName: PChar): HWND; external 'FindWindowA@User32.dll stdcall';

function SetParent(Child, Parent: HWND): HWND; external 'SetParent@User32.dll stdcall';

function RegHotKey(WindowHandle: HWND; ID: integer; fsMod, VKCode: Cardinal): Boolean; external 'RegisterHotKey@User32.dll stdcall';


//Usage...

function FindSmart: HWND;
var
Smart: HWND;
begin
Smart:= FindWindow('SunAwtFrame', 'Public SMARTv6.6 - SMART Minimizing Autoing Resource Thing - By BenLand100');
result:= Smart;
end;

Procedure SetParentSmart(Sender: TObject);
var
FormHandle: HWND;
line: string;
begin
if StrToBool(ReadINI('Changed', 'Changed', IncludePath+'Reflection/Custom/FormGUI.INI')) then
begin
WriteINI('Changed', 'Changed', 'False', IncludePath+'Reflection/Custom/FormGUI.INI');
if((ReadINI('SMART', 'SMART', IncludePath+'Reflection/Custom/FormGUI.INI') = 'Y') or
(ReadINI('SMART', 'SMART', IncludePath+'Reflection/Custom/FormGUI.INI') = 'y'))then
begin
FormTitleBarName:= 'Form1';
FormHandle:= FindWindow('', FormTitleBarName);
SetParent(FormHandle, FindSmart);
end;
end;
end;

Wizzup?

2012-01-06 16:05:45

Simba already has this, but more powerful: http://docs.villavu.com/simba/scriptref/window.html?highlight=getprocesses#getprocesses

StevenV

2012-11-14 10:10:10

That really helped me.

But now i'am testing it, and i can activate the client,
but when activated, it does not become the upper window or when the window is minimalized it doesn't open up.

Is there a way to achieve this?