Returns a list of window ID's for the specified process.
WinItemProcID (process-id, flags, return-type)
(i) process-id returned from RunShell.
(i) flags (see below).
(i) return-type (see below).
(s) a tab-delimited list of all top-level (parent) window ID's owned by the process specified by "process-id".
This function is designed to be used in correlation with RunShell.
You can obtain the process ID of an application that is launched with the RunShell function by specifying @GETPROCID as the "waitflag". This is the same as specifying @NOWAIT, except that on success RunShell will return the process ID of the application that was launched. This process ID can be used with the WinItemProcID function . The process ID returned by RunShell may be a negative number. If a process ID cannot be obtained, by RunShell, a 1 will be returned to indicate success. In all cases, a return value of 0 indicates failure.
"flags" can be 0, or one or more of the following values combined with the binary OR ("|") operator:
Flag |
Meaning |
0 |
Default list of window ID's |
1 |
Include windows with blank titles |
2 |
Include hidden windows |
4 |
Include windows which are not enabled for keyboard and mouse input |
8 |
Include windows with the title "WinOldAp" |
"return-type" specifies the format in which the list of windows will be returned, and can be one of the following:
Type |
Meaning |
0 |
Tab-delimited list of window ID's |
1 |
Tab-delimited list of window titles |
2 |
List of top-level window titles and their corresponding "Window ID's", in the form: "window1-name|window1-ID|window2-name|window2-ID|..."
|
Window ID's
The window ID is a specially formatted string that represents a 'pseudo-handle' of the window, that only WinBatch recognizes.
Windows ID's are recognized by all functions that also accept a partial window name.
You can use cWinIdConvert ( Control manager Extender) to convert between a true Windows handle and a Window Id (pseudo-handle). If you pass in a Windows handle, the function returns the corresponding Window ID. Conversely, if you pass in a Window ID, the function returns the corresponding Window handle.
procid = RunShell("calc.exe", "", "", @NORMAL, @GETPROCID) TimeDelay(3) If (procid != 0) && (procid != 1) ; if we got a valid process ID winids = WinItemProcId(procid, 2, 0) Message("Window ID(s)", winids) EndIf