Contents
Different types of match
- MatchAll
(Search string and caption must match exactly)
- MatchAllNoCase
(Search string and caption must match exactly, case ignored)
- MatchLeft
(Search string compared with first characters of caption)
- MatchLeftNoCase
(Search string compared with first characters of caption, case ignored)
- MatchRight
(Search string compared with last characters of caption)
- MatchRightNoCase
(Search string compared with last characters of caption, case ignored)
- MatchPart
(Search string can match any part of caption)
- MatchPartNoCase
(Search string can match any part of caption, case ignored)
Functions offered:
(Currently the descriptions are Pascal-based, but should give an adequate description
of their functionality)
-
function PushButton(const WindowName: string; Match1: word;
const ButtonName: string; Match2: word): boolean;
“Pushes” an on-screen button in another application. The button to be pressed has a
parent window caption that matches ParentName, based on the type-match constant
Match1, while the button caption matches ButtonName, based on the type-match
constant Match2.
(The type-match constants are defined at the start of this section.)
-
function WndPushButton(const Hwndd: Hwnd;
const ButtonName: string; Match2: word): boolean;
“Pushes” an on-screen button in another application. The button to be pressed has a
parent window whose handle is Hwndd, while the button caption matches ButtonName,
based on the type-match constant Match2.
-
function WndWndPushButton(const Hwndd,Hwndd2: Hwnd): boolean;
“Pushes” an on-screen button in another application. The button to be pressed has a
parent window whose handle is Hwndd, while the its own handle is Hwndd2.
-
function ClickMenu(const WindowName: string; Match1: word;
const MenuName: string; Match2: word;
const SubMenuName: string; Match3: word): boolean;
“Clicks” an on-screen menu in another application. The menu item to be activated
has a parent window caption that matches ParentName, based on the type-match
constant Match1, while the menu caption matches MenuName, based on the type-match
constant Match2, and the sub-menu caption matches SubMenuName, based on the
type-match constant Match3.
-
function WaitForWindowToClose(Name: string; Match: word; MSecs: longint): boolean;
Waits for the closure of a window whose caption matches Name, based on the type-match
constant Match, or times out after MSecs milli-seconds.
-
function WaitForWindowToOpen(Name: string; Match: word; MSecs: longint): boolean;
Waits for the creation of a window whose caption matches Name, based on the
type-match constant Match, or times out after MSecs milli-seconds.
-
function WaitForWindowToAppear(Name: string; Match: word; MSecs: longint): boolean;
Waits for the creation and display of a window whose caption matches Name, based on
the type-match constant Match, or times out after MSecs milli-seconds.
-
function WaitForWindowClassToOpen(Name, ClassName: string; Match: word;
MSecs: longint): boolean;
Waits for the creation of a window whose caption matches Name, based on the
type-match constant Match, and whose class is ClassName, or times out after
MSecs milli-seconds.
-
function WaitForWindowClassToAppear(Name, ClassName: string; Match: word;
MSecs: longint): boolean;
Waits for the creation and display of a window whose caption matches Name, based on
the type-match constant Match, and whose class is ClassName, or times out after
MSecs milli-seconds.
-
function WaitForChildWindowToOpen(Win: HWnd; Name: string; Match: word;
MSecs: longint): boolean;
Waits for the creation of a child window whose parent window handle is Win, and
whose own caption matches Name, based on the type-match constant Match, or times
out after MSecs milli-seconds.
-
function WaitForChildWindowToAppear(Win: HWnd; Name: string; Match: word;
MSecs: longint): boolean;
Waits for the creation and display of a window whose parent window handle is Win,
and whose own caption matches Name, based on the type-match constant Match, or
times out after MSecs milli-seconds.
-
function WndFindChildWindowXY(ParentWnd: Hwnd; X,Y: integer): HWnd;
Returns the handle of the child window, whose parent window handle is ParentWnd,
and which would receive any mouse click generated at coordinates X,Y.
The coordinates are relative to the top-left corner of the parent window.
-
function FindWindowExx(Name: string; Match: word): HWnd;
Returns the handle of a window whose caption matches Name, based on the type-match
constant Match.
-
function FindWindowClassExx(Name, ClassName: string; Match: word): HWnd;
Returns the handle of a window whose caption matches Name, based on the type-match
constant Match, and whose class is ClassName.
-
function FindChildWindowExx(ParentName: string; Match1: word;
ChildName: string; Match2: word): HWnd;
Returns the handle of a child window whose parent window caption matches ParentName,
based on the type-match constant Match1, and whose own caption matches ChildName,
based on the type-match constant Match2.
-
function FindChildWindowClassExx(ParentName, ClassName: string; Match1: word;
ChildName: string; Match2: word): HWnd;
Returns the handle of a child window whose parent window caption matches ParentName,
based on the type-match constant Match1, and whose class is ClassName, and whose
own caption matches ChildName, based on the type-match constant Match2.
-
function WndFindChildWindowExx(ParentWnd: Hwnd;
ChildName: string; Match2: word): HWnd;
Returns the handle of a child window whose parent window handle is ParentWnd,
and whose own caption matches ChildName, based on the type-match constant Match2.
-
function Encrypt(const szKey: string; const szSrc: string): string;
A simple encryption algorithm, but good enough for keeping passwords away from
prying eyes!
The string szSrc is encrypted using the key szKey, and the result returned.
-
function Decrypt(const szKey: string; const szSrc: string): string;
The complementary decryption algorithm.
The string szSrc is decrypted (using the same key szKey as was used for the
encryption), and the result returned.
-
procedure Wait(Secs: word);
A “well behaved” wait function, with the wait specified in seconds.
-
procedure MilliWait(MSecs: longint);
A “well behaved” wait function, with the wait specified in milli-seconds.
-
procedure safesendmessage(Window: THandle; msg: integer; wParam: word; lParam: longint);
A simple wrapper to the standard Windows API routine sendmessage, which only sends
the message if the value of Window is non-zero.
-
function GetWindowTextEx(hWndd: HWND; size: integer): string;
Although all it has to do is send a WM_GETTEXT message to the relevant window, I
have found that the standard Windows API routine GetWindowText can actually fail to
return text from certain classes of windows, when simply sending WM_GETTEXT works
fine. So here is a simple wrapper procedure that might just prove more reliable.
-
function GetClassNameEx(hWndd: HWND; size: integer): string;
Just in case the standard GetClassName API routine can misbehave like GetWindowText,
here is another simple wrapper procedure.
Download...
Copyright Dragon Enterprises 1996 - 2001