ph_locatehandle1 PowerHome formula function
Description
Locates and returns the handle of a process
identifed by the specified
parameters.
Syntax
ph_locatehandle1
( handle, exe, class, title, instance,
flags
)
Argument |
Description |
handle |
Long. The handle from where to begin the search. If 0, then
the search begins with top windows processes. If other than 0, then the
search will begin with children of the specified handle. |
exe |
String. The executable name of the process to match.
Controlled by the flags parameter. |
class |
String. The class name of the process to match. Controlled
by the flags parameter. |
title |
String. The title of the process to match. Can be an exact
match or a partial match and is controlled by the flags parameter. |
instance |
Integer. The matching instance to return the handle of. For
a specific set of parameters, multiple matches may be returned as
determined by the Z-order. If instance = 0, then the handle of the first
match will be found. If 1, then the second match handle will be returned,
etc. |
flags
|
Integer. Controls which of the 3
parameters above (exe, class, title) to use in the search. See
usage below.
|
Return value
Long. Returns the handle of the specified
matching process.
Usage
Use this function to retrieve the handle of
specified processes.
The flags parameter is detailed in the table below:
1 |
Add 1 to the flags parameter to match on the specified
exe. |
2 |
Add 2 to the flags parameter to match on the specified class
name. |
4 |
Add 4 to the flags parameter to exactly match on the
specified title. |
8 |
Add 8 to the flags parameter to partially match on the
specified title. The way this match works is if the title you specifiy is
10 characters long, it must match the first 10 characters of the searched
title in order to be a match. |
To match on exe and
the exact title, you would add 1 and 4 together to arrive at 5 for the flags
parameter. Values 4 and 8 should be considered mutually exclusive of one another
(you would never add both 4 and 8 to the
flags parameter).
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_locatehandle1(0,"Explorer.EXE","","logs",0,5)
The
above example will search for the first instance of Windows Explorer whose title
is "logs" and returns the handle if
found.