Promotic
WikipediaLinkedInYoutubeTwitterFacebook

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 in OS Windows)
vPar0 (Long) - the code of the Windows message
vPar1 (Long) - the first parameter WPARAM of the Windows message
vPar2 (Long) - the second parameter LPARAM 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 window position and size (in pixels) in the form of PmMap. 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 abd/or size of the window (in pixels) in the form of PmMap in parameter vPar0. 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 values:
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 independent window (if it is open).

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 window header.

 
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 not functional in Web panels.
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 the independet window with identifier _blank:alarms (this application):
JavaScriptVBScriptSelect and copy to clipboard

Pm.WndOper(0, "_blank.alarms", 10);
Example3:
Moving the window with alarm viewer with identifier _blank:alarms 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 alarm viewer window with identifier _blank:alarms. Saving the values into 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 ini file. Setting the position and size of the alarm viewer window with identifier _blank:alarms:
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.14: Created
PROMOTIC 9.0.15 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.Tavičská 845/21 703 00 Ostrava-Vítkovice