Update cookies preferences
Promotic

WndOper - method of the Pm object

Description:
Operation execution over the opened window of another application.
Syntax:
Boolean WndOper(Long nMode, String sWnd, Long nOper, [Variant vPar0], [Variant vPar1], [Variant vPar2])
Parameters:
nMode(Long) Finding the open window:
0 - The value of the sWnd parameter corresponds to the frame identifier blankid (see _blank.blankid) of this application.
1 - The value of the sWnd parameter corresponds to the whole text in the header of the window of another application.
2 - The value of the sWnd parameter corresponds to the beginning of the text in the header of the window of another application.
3 - The value of the sWnd parameter is included inside the text in the header of the window of another application.
sWnd(String) Text that describes open the window of this or another application.
nOper(Long) Required operation over the open window:
0 - Test whether the window is opened.
Don't set the parameters vPar0, vPar1 and vPar2.
1 - Sending the Windows message to the window (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 open window (if it is a main window then closing the whole application).
Don't set the parameters vPar0, vPar1 and vPar2.
11 - Moving the opened window on top.
Don't set the parameters vPar0, vPar1 and vPar2.
12 - Minimization of the opened window.
Don't set the parameters vPar0, vPar1 and vPar2.
13 - Maximization of the opened window.
Don't set the parameters vPar0, vPar1 and vPar2.
14 - Restore Down of the open window.
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.
21 - Sets the position and/or window size (in pixels) in the form of the PmMap object in the vPar0 parameter.
PmMap contains properties x, y, dx and dy defining the position and size.
Don't set the parameters 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 executing the operation over the specified separate window (if is opened).
If it is the window of this application then it is identified by frame identifier blankid (see _blank.blankid).
If it is the window of another application then it is identified by the text in the window title bar.


There is a confirmed limitation of sending the Windows messages (Pm.WndOper) 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 also functional in Web panels. For now, it is functional only for nMode == 0 and nOper == 0/10.
See also:
- PmViewCreator.Frame (property)
Example1:
Test the existence of the Calculator window (other application):
JavaScriptVBScriptSelect and copy to clipboard

if (Pm.WndOper(1, "Calculator", 0))
{
// ...
}
or
JavaScriptVBScriptSelect and copy to clipboard

if (Pm.WndOper(3, "alculato", 0))
{
// ...
}
Example2:
Closing the alarm viewer in a separate window with _blank.alarms identifier (this application):
JavaScriptVBScriptSelect and copy to clipboard

Pm.WndOper(0, "_blank.alarms", 10);
Example3:
Moving the window with alarm viewer with _blank.alarms identifier to defined position on the other display and then maximizing it:
JavaScriptVBScriptSelect and copy to clipboard

var oRect = Pm.CreatePmMap();
oRect.x = 1920;
oRect.y = 0;
oRect.dx = 1000;
oRect.dy = 800;
Pm.WndOper(0, "_blank.alarms", 21, oRect);
Pm.WndOper(0, "_blank.alarms", 13);
Example4:
Detecting the position and size of the alarm viewer window with _blank.alarms identifier. Saving the values into the INI file:
JavaScriptVBScriptSelect and copy to clipboard

var oRect = Pm.WndOper(0, "_blank.alarms", 20);
var bWrite = Pm.IniFileWrite("#cfg:Config.ini", "Position", "alarms", Pm.JsonStringify(oRect));
Reading the position from the ini file. Setting the position and size of the alarm viewer window with _blank.alarms identifier:
JavaScriptSelect and copy to clipboard

var sRect = Pm.IniFileRead("#cfg:Config.ini", "Position", "alarms", '{"x":0;"y":0;"dx":900;"dy":500;}');
Pm.WndOper(0, "_blank.alarms", 21, Pm.JsonParse(sRect).Value);

History:
Pm9.00.26: Available for Web panels. For now, it is functional only for nMode == 0 and nOper == 0/10.
Pm9.00.14: Created
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- LN2
- PI
- Pow
- Sin
- Tan
- WndOper
 
 
© MICROSYS, spol. s r.o.