Win_FindByTitle

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > UI (User Interface) > Windows API >

Win_FindByTitle

 

Description

 

Try to find a window with the specified window title.

Different find methods are handled.

 

Syntax

 

hWnd = Win_FindByTitle(WindowTitle [, FindMethod])

 

Returns

 

Number: handle to the window if found

 

Parameters

 

Name

Type

Optional

Meaning

WindowTitle

String

No

Title (full or partial) text inside window title

FindMethod

Number

Yes

Method to use for searching.

Possible values re the following:

%WIN_FindTitleEqual

%WIN_FindTitleStart

%WIN_FindTitleEnd

%WIN_FindTitleContain

 

 

Remarks

 

WindowTitle can contain the following starting or ending string: "...". This string will be used has preferred method.

 

For example:

if WindowTitle starts with "..." followed by some text function will find a window whose title ends with the text following "...".

if WindowTitle ends with "..." followed by some text function will find a window whose title starts with the text preceding "...".

if WindowTitle starts and ends with "..." with some text in between, function will find a window whose title contains the text specified between starting and ending "...".

 

Use of "..." have higher priority than FindMethod. For example, if WindowTitle contains "Calc..." and FindMethod is %WIN_FindTitleEnd, a "Start With" method will in any case used.

 

Restrictions

 

See also

 

Examples

 

Uses "UI"

 

Dim hWnd As Long

 

hWnd = Win_FindByTitle("Calc...")     '---Will try to find a window whose title starts with "Calc"

hWnd = Win_FindByTitle("Calc"%WIN_FindTitleStart'---Exactly the same as above