Below you will find more specific information about FindWindows functions, including function syntax and some examples.
Syntax:
FindWindows(
Caption:String,
Application:String [optional],
CaptionMatchCase:Integer [optional],
CaptionWholeWordOnly:Integer [optional],
AppNameMatchCase:Integer [optional],
AppNameWholeWordOnly:Integer [optional]
)
Parameters
Caption:String –
Caption of the window that need to be found. If this param is a empty string, it will be ignored.
Application:String [optional] –
You can specify application name, which will be implemented in the search. If this param is a empty string, it will be ignored.
CaptionMatchCase:Integer [optional] –
1 – search in Caption will be case sensitive, 0 – search in caption will be case insensitive. Default value is 0;
CaptionWholeWordOnly:Integer [optional] –
0 – search Caption in window caption, 1 – window caption must be equal to Caption. Default value is 0;
AppNameMatchCase:Integer [optional] –
1 – search in application name will be case sensitive, 0 – search in application name will be case insensitive. Default value is 0;
AppNameWholeWordOnly:Integer [optional]
0 – search Application in application name, 1 – application name must be equal to Application. Default value is 0;
Return Value
Return a string, that contains handle(s),comma separated, of the windows, that match specified parameters.
Example #1
s := FindWindows('Opera');//searching browser handle
i := 0;
cnt := ListSize(s);
ShowHint(cnt,'Found windows count');
for i:=0 to ListSize(s)-1 do
if WindowVisible(s,i) = 1 then
begin
h := ListItem(s,0);
SendMessage(h,'Activate');
ShowHint(h,'Handle activated');//activate handle
end;
Download example findwindows1
Example #2
s :=FindWindows('','opera');//
searching browser handle by part of application name
i := 0;
for i:= 0 to ListSize(s)-1 do
if WindowVisible(s,i) = 1 then
begin
h := ListItem(s,i);
SendMessage(h,'Minimize');
end;
Download example findwindows2
References
Leave a Reply