Log in

View Full Version : Find a Window



caused
09-26-2012, 08:40 PM
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
09-26-2012, 08:44 PM
you could make the icon as a DTM then adjust accordingly using MouseSetClientArea

Brandon
09-26-2012, 08:51 PM
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:



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;


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

caused
10-07-2012, 01:45 PM
Thanks for the replies.

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

Brandon
10-07-2012, 01:47 PM
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
10-07-2012, 02:18 PM
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
10-07-2012, 04:09 PM
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
10-07-2012, 04:14 PM
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
12-13-2012, 10:48 PM
Hi!

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