OtherAppOper - method of the Pm object
Description:
Operation execution over the opened window of another application.
This method is obsolete (but functional) and it is better to use the
Pm.WndOper method.
Syntax:
Boolean OtherAppOper(Long nMode, String sApp, Long nOper, [Variant vPar0], [Variant vPar1], [Variant vPar2])
Parameters:
nMode | (Long) The way how to find the window of another started application:
1 - The value of the sApp parameter corresponds to the whole title of the wanted window.
2 - The value of the sApp parameter corresponds to the beginning of the wanted window title text.
3 - The value of the sApp parameter is included inside the wanted window title. |
sApp | (String) Text that describes the window of another started application. |
nOper | (Long) Required operation over the started window of another application:
0 - Test whether the window of another application is opened. Don't set the parameters vPar0, vPar1 and vPar2.
1 - Sending the Windows message to the window of another application (see the documentation Win32 API interface Windows OS)
vPar0 (Long) - the code of the Windows message
vPar1 (Long) - the first WPARAM parameter of the Windows message
vPar2 (Long) - the second LPARAM parameter of the Windows message
10 - Closing the window of another application (if it's a main window, then closing the whole application). Don't set the parameters vPar0, vPar1 and vPar2.
11 - Moving the opened window of another application on top. Don't set the parameters vPar0, vPar1 and vPar2.
12 - Minimization of the opened window of another application. Don't set the parameters vPar0, vPar1 and vPar2.
13 - Maximization of the opened window of another application. Don't set the parameters vPar0, vPar1 and vPar2.
20 - Returns position and window size (in pixels) in the form of the PmMap object. PmMap contains properties x, y, dx and dy defining the position and size. Don't set the parameters vPar0, vPar1 and vPar2. |
vPar0 | [optional] (Variant) The meaning depends on the operation (on the nOper parameter). |
vPar1 | [optional] (Variant) The meaning depends on the operation (on the nOper parameter). |
vPar2 | [optional] (Variant) The meaning depends on the operation (on the nOper parameter). |
---|
Return value:
true - Wanted window has been found and the operation has been successfully performed.
false - Wanted window hasn't been found or the required operation has failed.
Note:
The method allows to find if there is or isn't an opened window of another application in the system, identified by text in the window title bar (e.g. if it's opened the "Calculator" application at the moment, etc.), eventually to execute the operation over the window of another application (e.g. close, minimize, move on top the window of the "Calculator" application).
There is a confirmed limitation of sending the
Windows messages from 32-bit program to a window of 64-bit program. The 32-bit has to be running with higher permissions ("Run as administrator").
This method
is not functional in
Web panels.
Example1:
Test the existence of the Calculator window:
JavaScriptVBScriptSelect and copy to clipboard
if (Pm.OtherAppOper(1, "Calculator", 0))
{
// ...
}
If Pm.OtherAppOper(1, "Calculator", 0) Then
' ...
End If
or
JavaScriptVBScriptSelect and copy to clipboard
if (Pm.OtherAppOper(3, "alculato", 0))
{
// ...
}
If Pm.OtherAppOper(3, "alculato", 0) Then
' ...
End If
Example2:
Exit the Calculator:
JavaScriptVBScriptSelect and copy to clipboard
Pm.OtherAppOper(1, "Calculator", 10);
Pm.OtherAppOper 1, "Calculator", 10
Example3:
Moving the opened Calculator window on top:
JavaScriptVBScriptSelect and copy to clipboard
Pm.OtherAppOper(1, "Calculator", 11);
Pm.OtherAppOper 1, "Calculator", 11
History:
Pm8.03.27: New parameter
nOper=20 for detecting of position and size of application window.