SRL Archive - Help

Find a Window


caused

2012-09-26 16:40:48

Hey,
how can you find and use a client window with simba. Lets say by size or by title.

Is there an inbuild function ?

putonajonny

2012-09-26 16:44:02

you could make the icon as a DTM then adjust accordingly using MouseSetClientArea

Brandon

2012-09-26 16:51:29

Don't use DTM's.. They're over suggested.. It's not the answer to everything. Not sure why anyone would use a DTM to find a window. No disrespect to the suggester above, but I wouldn't use a DTM..


function FindWindow(TitlePrefix: String): Boolean;
var
T: TSysProcArr;
I: Integer;
begin
T:= GetProcesses();
for I := 0 to high(T) do
if ExecRegExpr(TitlePrefix, T[i].Title) then //If you aren't familiar with RegExpressions, use (Pos(...) > 0)
Result := True;
end;


OR use an extension:

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

function FindSmart: HWND; //Returns a handle to the found window..
var
Smart: HWND;
begin
Smart:= FindWindow('SunAwtFrame', 'Public SMARTv6.9 - SMART Minimizing Autoing Resource Thing - By BenLand100');
result:= Smart;
end;
[/PHP]

For other extension stuff, view my extension here: http://villavu.com/forum/showthread.php?t=65657

caused

2012-10-07 09:45:58

Thanks for the replies.

Can you set the found window as new client for simba ?

Brandon

2012-10-07 09:47:45

From: caused
Thanks for the replies.

Can you set the found window as new client for simba ?




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

litoris

2012-10-07 10:18:46

So doing this:

{$IFDEF SMART}
//six hour fix, etc.
{$ELSE}
FindAndSetTarget('Runescape'; True);
{$ENDIF}
Would work if we didn't have SMART defined but had an RS window open, whose name Has Runescape at some point? Or does the word have to be at the beginning of the title?

caused

2012-10-07 12:09:08

Thats working great *-* thanks so much.

One more question :D… Can you find Child elements in Windows, Like Edit fields and stuff. And Can you send text to those ? With like "Post Message" ???

Brandon

2012-10-07 12:14:12

From: caused
Thats working great *-* thanks so much.

One more question :D… Can you find Child elements in Windows, Like Edit fields and stuff. And Can you send text to those ? With like "Post Message" ???


With an extension that would be no problem. With Simba I don't think so :S

Maybe a plugin? Why not make a plugin that does all that stuff and returns the handles?

Getting ChildWindow handles would be quite the task in Lape and Simba since those are windows extensions.

Perhaps if Simba could use Typedefs to get exported functions from a DLL. Other than that, an Extension or a plugin WILL be required.

I remember writing an "extension" called SmartChat that does this. I believe Daniel has also written a "plugin" that contains most WinAPI functions and you just load it and use it.

penguII

2012-12-13 17:48:36

Hi!

Can you also CLOSE, MINIMIZE, MAXIMIZE a target window ??