Disclosure of Invention
First, the technical problem to be solved
In view of the foregoing drawbacks and disadvantages of the prior art, the present application provides a method, system, apparatus, and readable storage medium for multi-window control based on a windows operating system.
(II) technical scheme
In order to achieve the above purpose, the application adopts the following technical scheme:
In a first aspect, an embodiment of the present application provides a method for controlling multiple Windows based on a Windows operating system, which is applied to an application system running in a Windows environment, where the method includes:
S10, dividing all target windows of the application system into a first window group, a second window group and a third window group; wherein the number of the target windows is more than or equal to 3;
s20, setting the window attribute of the first window group as a top-set window, setting the window attribute of the second window group as a conventional window, and setting the window attribute of the third window group as a top-set window or a conventional window;
S30, receiving a message notification of the Windows system on the change of the Z-Order of the target window in the third window group, and setting the target window to a preset level through a message notification response function.
Optionally, the preset layer is the topmost layer or the bottommost layer.
Optionally, when the window attribute of the third window group is set as a top-set window, the preset hierarchy is the top-most layer;
when the window attribute of the third window group is set as a conventional window, the preset hierarchy is the bottommost layer.
Optionally, the message notification is a wm_ WINDOWPOSCHANGING message.
Optionally, notifying, by the message, the response function of the behavior of changing the window Z-Order, including:
The values of WINDOWPOS structural members passed as parameters are modified in the message response function.
Optionally, when the preset hierarchy is the lowest layer, the WINDOWPOS structural member is HWNDINSERTAFTER.
Optionally, the value of WINDOWPOS structural members passed as parameters is modified to hwnd_bootom.
In a second aspect, an embodiment of the present application provides an operation maintenance system for a Distributed Control System (DCS), where when interacting with a user, the system performs control of a plurality of windows on a desktop by using the window operating system-based multi-window control method according to any one of the first aspect above.
In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, which when executed by the processor performs the steps of the windows operating system based multi-window control method as set forth in any one of the first aspects above.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a windows operating system based multi-window control method as set forth in any one of the first aspects above.
(III) beneficial effects
The beneficial effects of the application are as follows: the application provides a multi-window control method based on a window operating system, which is applied to an application system running in a Windows environment, and comprises the following steps: s10, dividing all target windows of the application system into a first window group, a second window group and a third window group; wherein the number of the target windows is more than or equal to 3; s20, setting the window attribute of the first window group as a top-set window, setting the window attribute of the second window group as a conventional window, and setting the window attribute of the third window group as a top-set window or a conventional window; s30, receiving a message notification of the Windows system on the change of the Z-Order of the target window in the third window group, and setting the target window to a preset level through a message notification response function. The control method can efficiently and simply realize three-level management of the windows, and effectively solve the requirement of a user on three-level management of multiple windows.
Detailed Description
The application will be better explained by the following detailed description of the embodiments with reference to the drawings. It is to be understood that the specific embodiments described below are merely illustrative of the related application, and not restrictive of the application. In addition, it should be noted that, in the case of no conflict, the embodiments of the present application and the features in the embodiments may be combined with each other; for convenience of description, only parts related to the application are shown in the drawings.
Before describing the embodiments in detail, the Z-order concept will be described. The Z-order of a window indicates the position of the window in a stack of windows. The stack of windows extends outwardly from the screen along an imaginary axis, the Z-axis. The window at the top of the Z-order will press against the other windows. The window at the bottom of the Z-order will be pressed by the other windows.
Before Windows 8, all Windows of the operating system are managed in the same Z-Order window group, namely, the desktop window group (ZBID _ DESKTOP), and the window with Z-Order ranking of high covers the window with Z-Order ranking of low, and the window with newly obtained focus is positioned at the top of all Windows. Meanwhile, the system supports the "top-set" attribute (HWN _ TOPMOST) of the window, fig. 2 is a schematic diagram of the hierarchical relationship between the conventional window and the top-set window of the Windows desktop, as shown in fig. 2, the top-set window 1-N with the "top-set" attribute is always ranked higher than the conventional window 1-N without the "top-set" attribute, namely: the top window is always positioned above the non-top window. In other words, the operating system subdivides the desktop window group into two sub-groups: a regular window subgroup and a top-placed window subgroup.
From Windows 8, microsoft introduced other window groups, each of which has a Z-Order higher than the desktop window group, and the Windows in the other window groups can also be divided into two subgroups: a regular window subgroup and a top-placed window subgroup. As such, any conventional or set-top window created by a third party developer other than microsoft cannot overlay the contents of other window groups.
The invention provides a multi-window control method based on a Windows environment to solve the requirement of a user on three-level management of a user interface, and the method is described below through a specific embodiment.
Example 1
FIG. 1 is a flow chart of a multi-window control method based on a Windows operating system according to an embodiment of the present application. As shown in fig. 1, the multi-window control method based on the Windows operating system of the present embodiment is applied to an application system running in a Windows environment, and includes:
s10, dividing all target windows of an application system into a first window group, a second window group and a third window group; wherein the number of target windows is 3 or more;
S20, setting the window attribute of the first window group as a top-set window, setting the window attribute of the second window group as a conventional window, and setting the window attribute of the third window group as a top-set window or a conventional window;
S30, receiving a message notification of the Windows system on the change of the Z-Order of the target window in the third window group, and setting the target window to a preset level through a message notification response function.
The multi-window control method based on the window operating system can efficiently and simply realize three-level management of windows, and effectively solve the requirement of a user on three-level management of the multi-windows.
In order to better understand the present invention, each step in this embodiment is explained below.
In this embodiment S10, the application system may be an application program developed by the user for specific needs, such as operation maintenance software in the DCS system.
In this embodiment S30, the preset layer is the topmost layer or the bottommost layer.
Thus, in the embodiment S20, when the window attribute of the third window group is set as the top window, the preset hierarchy is the top layer;
when the window attribute of the third window group is set as a regular window, the preset hierarchy is the bottommost layer.
For example, when the preset layer is the topmost layer, a window "two-layer management" is implemented between the top-setting windows, so that a part of top-setting windows can be always located at the uppermost part of all top-setting windows and can not be covered by other top-setting windows. For convenience of the following description, this type of special overhead window will be referred to as the "topmost window". When the preset level is the bottommost layer, a window 'two-level management' is realized between the conventional windows, so that a part of the conventional windows can be always positioned at the bottommost of all the conventional windows, and other conventional windows can not be actively covered. For convenience of the following description, this type of special top-placed window will be referred to as the "bottommost window".
FIG. 3 is a schematic diagram of the bottom-most window, the regular window and the top-most window according to an embodiment of the present application, where the relationship between the bottom-most window, the regular window and the top-most window is:
The bottommost window: always positioned at the lowest part of the system Z-Order and covered by two other types of windows;
roof window: always positioned at the uppermost part of the system Z-Order, and covering two other types of windows;
conventional window: is positioned between the bottom window and the top window, covers the bottom window, and is covered by the top window.
The windows of the same category can be mutually covered, and the specific coverage relationship is determined by the focus of the windows: and finally, the window with the focus is positioned at the uppermost part of the window with the current category and covers other windows with the same category.
In this embodiment S30, the message notification is a wm_ WINDOWPOSCHANGING message, and the action of changing the Order of the window Z-Order by the message notification response function includes:
The values of WINDOWPOS structural members passed as parameters are modified in the message response function.
Specifically, when the preset hierarchy is the lowest layer, WINDOWPOS structural member is HWNDINSERTAFTER, and the value of WINDOWPOS structural member transferred as a parameter is hwnd_bootom.
Two examples are given below to specifically illustrate the implementation of the method of the present embodiment.
1. The windows of the third window group are the bottommost windows.
The method comprises the following steps:
S1, when an application system is developed, three or more windows are created, wherein the three windows are a window A, a window B and a window C respectively, the window A is used as a bottommost window, the window B is used as a common window, and the window C is used as a top setting window.
S2, window a responds to wm_ WINDOWPOSCHANGING message and assigns HWNDINSERTAFTER of parameter WINDOWPOS x lpwndpos to hwnd_bootom.
S3, setting the attribute of the window B to contain a conventional window, and setting the attribute of the window C to contain a top setting attribute (HWND_ TOPMOST).
At this time, the bottommost window, the common window and the top-setting window are three-layer relations, and a plurality of common windows and top-setting windows are created, so that the windows do not interfere with window relations of other layers when being mutually switched.
If there are a plurality of bottommost windows, all bottommost windows cannot be displayed at the same position at the same time, so that coverage is avoided.
The bottommost window implementation source code is exemplified as follows:
2. the windows of the third window group are the topmost windows.
Implementation of the launch hiding effect of the MFC dialog program.
The scheme for realizing the topmost window is as follows: the message notification of the window Z-Order change by the Windows system can be received in the topmost window and the behavior of the window Z-Order change can be altered in the message notification response function. Specifically, when there are other top-set windows to cover the topmost window, the topmost window can receive the message notification, and modifying the value of the corresponding message parameter can prevent the current window covering behavior. I.e. via WM WINDOWPOSCHANGIN message in Windows. The WM_ WINDOWPOSCHANGING message is sent to the corresponding window before the Windows system or the third party developer calls the SetWindow Pos function or other window management functions to change the position, size and Z-Order of the designated window, and meanwhile, the message response function is modified to serve as the value of the WINDOWPOS structural member of parameter transfer to change the behavior of the message processing.
When the MFC dialog program is started, the SWP SHOWWINDOW attribute value of the member of the WINDOWPOS structure flags is directly removed from the WM_ WINDOWPOSCHANGING message response function, so that the starting hiding effect of the MFC dialog program can be perfectly realized.
Example two
The second aspect of the present application proposes an operation and maintenance system for DCS, which performs control of a plurality of windows on a desktop by the window operating system-based multi-window control method according to any one of the above embodiments when interacting with a user.
For example, the system function block panel and the global function block panel of the operation and maintenance system always need to be located above the windowed flowchart, but the windowed flowchart still needs to be located above the monitoring main interface all the time, so the window "three-level management" can be implemented in the product code in the form of the bottommost window, the conventional window, and the top-set window in the first embodiment: all the monitoring main interface windows are set to be bottommost windows, the monitoring operation interface windows which are required to be always positioned at the uppermost position, such as a system function block panel and a global function block panel, are set to be top-mounted windows, and other monitoring operation interface windows are set to be conventional windows.
The intelligent manufacturing system for the operation maintenance system of the DCS solves the problem that monitoring operation software in the existing DCS only carries out two-level management on windows and cannot meet the requirement of users on three-level management on the windows.
Example III
A third aspect of the present application provides, in a third embodiment, an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program when executed by the processor implementing the steps of a windows operating system based multi-window control method as set forth in any one of the above embodiments.
Fig. 4 is a schematic diagram of an architecture of an electronic device according to another embodiment of the application.
The electronic device shown in fig. 4 may include: at least one processor 101, at least one memory 102, at least one network interface 104, and other user interfaces 103. The various components in the electronic device are coupled together by a bus system 105. It is understood that the bus system 105 is used to enable connected communications between these components. The bus system 105 includes a power bus, a control bus, and a status signal bus in addition to a data bus. But for clarity of illustration the various buses are labeled as bus system 105 in fig. 4.
The user interface 103 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, a trackball (trackball), or a touch pad, etc.).
It will be appreciated that the memory 102 in this embodiment may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile memory may be a Read-only memory (ROM), a programmable Read-only memory (ProgrammableROM, PROM), an erasable programmable Read-only memory (ErasablePROM, EPROM), an electrically erasable programmable Read-only memory (ElectricallyEPROM, EEPROM), or a flash memory, among others. The volatile memory may be a random access memory (RandomAccessMemory, RAM) that acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as static random access memory (STATICRAM, SRAM), dynamic random access memory (DYNAMICRAM, DRAM), synchronous dynamic random access memory (SynchronousDRAM, SDRAM), double data rate synchronous dynamic random access memory (DoubleDataRate SDRAM, ddr SDRAM), enhanced synchronous dynamic random access memory (ENHANCED SDRAM, ESDRAM), synchronous link dynamic random access memory (SYNCHLINKDRAM, SLDRAM), and direct memory bus random access memory (DirectRambusRAM, DRRAM). The memory 62 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some implementations, the memory 102 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 1021, and application programs 1022.
The operating system 1021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, for implementing various basic services and processing hardware-based tasks. Application 622 includes various applications for implementing various application services. A program for implementing the method of the embodiment of the present invention may be included in the application program 1022.
In an embodiment of the present invention, the processor 101 is configured to execute the method steps provided in the first aspect by calling a program or an instruction stored in the memory 102, specifically, a program or an instruction stored in the application 1022.
The method disclosed in the above embodiment of the present invention may be applied to the processor 101 or implemented by the processor 101. The processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 101 or instructions in the form of software. The processor 101 described above may be a general purpose processor, a digital signal processor, an application specific integrated circuit, an off-the-shelf programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software elements in a decoding processor. The software elements may be located in a random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in the memory 102, and the processor 101 reads information in the memory 102, and in combination with its hardware, performs the steps of the method described above.
In addition, in combination with the window operating system-based multi-window control method in the above embodiment, the embodiment of the present invention may provide a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of any one of the window operating system-based multi-window control methods in the above method embodiment.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. The use of the terms first, second, third, etc. are for convenience of description only and do not denote any order. These terms may be understood as part of the component name.
Furthermore, it should be noted that in the description of the present specification, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to a specific feature, structure, material, or characteristic described in connection with the embodiment or example being included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art upon learning the basic inventive concepts. Therefore, the appended claims should be construed to include preferred embodiments and all such variations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, the present invention should also include such modifications and variations provided that they come within the scope of the following claims and their equivalents.