CN117435313A - Desktop screen capturing method, device, equipment and storage medium based on window filtering - Google Patents
Desktop screen capturing method, device, equipment and storage medium based on window filtering Download PDFInfo
- Publication number
- CN117435313A CN117435313A CN202311035644.XA CN202311035644A CN117435313A CN 117435313 A CN117435313 A CN 117435313A CN 202311035644 A CN202311035644 A CN 202311035644A CN 117435313 A CN117435313 A CN 117435313A
- Authority
- CN
- China
- Prior art keywords
- screen
- desktop
- screen capturing
- capturing
- main process
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 197
- 238000001914 filtration Methods 0.000 title claims abstract description 78
- 230000008569 process Effects 0.000 claims abstract description 124
- 230000002159 abnormal effect Effects 0.000 claims abstract description 90
- 230000015654 memory Effects 0.000 claims description 26
- 230000005856 abnormality Effects 0.000 claims description 20
- 230000008859 change Effects 0.000 claims description 13
- 239000002609 medium Substances 0.000 description 13
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 7
- 238000001514 detection method Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 230000003321 amplification Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 239000012120 mounting media Substances 0.000 description 1
- 238000003199 nucleic acid amplification method Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 239000007858 starting material Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0484—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
- G06F3/04845—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The embodiment of the application discloses a desktop screen capturing method and device based on window filtering, electronic equipment and a storage medium. According to the technical scheme provided by the embodiment of the application, the main process is established, the sub-process is established based on the main process, and the screen capturing instruction is issued to the sub-process, wherein the screen capturing instruction comprises handle information of a designated window; collecting desktop images based on the subprocesses, filtering designated windows in the desktop images according to the handle information, generating desktop screen shots and sending the desktop screen shots to the main process, or sending screen shot abnormal information to the main process under the condition of abnormal screen shots; and receiving the desktop screen capturing or the screen capturing abnormal information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing abnormal information is received. By adopting the technical means, abnormal screen capturing conditions can be reduced, the stability and reliability of desktop screen capturing are improved, the condition that the screen capturing operation is inefficient or even fails due to repeated abnormal screen capturing is avoided, and the desktop screen capturing experience of a user is improved.
Description
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a desktop screen capturing method and device based on window filtering, electronic equipment and a storage medium.
Background
At present, in live broadcast, recording and other scenes, screen capturing operation is often required to be performed on a screen desktop, and images or videos are generated to be stored and pushed. In the screen capturing process, in order to avoid saving or pushing part of unnecessary display content, the desktop screen capturing needs to be filtered. And filtering a corresponding window of the desktop in the screen capturing process by adopting a capture (amplification) screen capturing mode so that the screen capturing image meets the screen capturing requirement of a user.
However, when window filtering is performed by using the Magnification screen capturing method, multiple processes need to be invoked to perform screen capturing and window filtering operations. Abnormal conditions easily occur in multi-process calling, so that screen capturing failure is caused, screen capturing reliability and screen capturing efficiency are affected, and user experience is poor.
Disclosure of Invention
The embodiment of the application provides a desktop screen capturing method, device, electronic equipment and storage medium based on window filtering, which can improve the reliability of desktop screen capturing and solve the problem of abnormal screen capturing caused by window filtering of the desktop screen capturing.
In a first aspect, an embodiment of the present application provides a desktop screen capturing method based on window filtering, including:
creating a main process, creating a sub-process based on the main process, and issuing a screen capturing instruction to the sub-process, wherein the screen capturing instruction comprises handle information of a designated window;
collecting desktop images based on the subprocesses, filtering designated windows in the desktop images according to the handle information, generating desktop screen shots and sending the desktop screen shots to the main process, or sending screen shot abnormal information to the main process under the condition of abnormal screen shots;
and receiving the desktop screen capturing or the screen capturing abnormal information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing abnormal information is received.
In a second aspect, an embodiment of the present application provides a desktop screen capturing device based on window filtering, including:
the creation module is used for creating a main process, creating a subprocess based on the main process, and issuing a screen capturing instruction to the subprocess, wherein the screen capturing instruction comprises handle information of a designated window;
the screen capturing module is used for acquiring a desktop image based on the subprocess, filtering a designated window in the desktop image according to the handle information, generating a desktop screen capturing and sending the desktop screen capturing to the main process, or sending screen capturing abnormal information to the main process under the condition of abnormal screen capturing;
the exception handling module is used for receiving the desktop screen capturing or screen capturing exception information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing exception information is received.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a memory and one or more processors;
the memory is used for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the window filtering based desktop screen capture method as described in the first aspect.
In a fourth aspect, embodiments of the present application provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing a window filtering-based desktop screen capture method as described in the first aspect.
According to the embodiment of the application, the main process is created, the sub-process is created based on the main process, and the screen capturing instruction is issued to the sub-process, wherein the screen capturing instruction comprises handle information of a specified window; collecting desktop images based on the subprocesses, filtering designated windows in the desktop images according to the handle information, generating desktop screen shots and sending the desktop screen shots to the main process, or sending screen shot abnormal information to the main process under the condition of abnormal screen shots; and receiving the desktop screen capturing or the screen capturing abnormal information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing abnormal information is received. By adopting the technical means, the main process is adopted to create the subprocess to perform desktop screen capturing operation, and when the screen capturing is abnormal, the desktop screen capturing operation is re-executed according to the abnormal information of the subprocess returned to the screen capturing, so that the abnormal condition of the screen capturing can be reduced, the stability and the reliability of the desktop screen capturing are improved, the condition that the screen capturing operation is inefficient or even fails due to repeated screen capturing abnormality is avoided, and the desktop screen capturing experience of a user is improved.
Drawings
FIG. 1 is a flowchart of a desktop screen capturing method based on window filtering according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating inter-process communication according to an embodiment of the present application;
FIG. 3 is a flowchart of a desktop screenshot operation in a first embodiment of the present application;
fig. 4 is a schematic structural diagram of a desktop screen capturing device based on window filtering according to a second embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to a third embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the following detailed description of specific embodiments thereof is given with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of the application and not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the matters related to the present application are shown in the accompanying drawings. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart depicts operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently, or at the same time. Furthermore, the order of the operations may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The desktop screen capturing method based on window filtering aims at creating a main process, creating a sub-process by using the main process to perform desktop screen capturing operation, and re-executing the desktop screen capturing operation according to the abnormal information of the sub-process when the screen capturing is abnormal, so that the stability and the reliability of the desktop screen capturing are improved.
For the related Magnification screen capturing scheme, when the desktop screen capturing operation is performed, a plurality of processes need to be created to execute the screen capturing operation, and in the process of executing the screen capturing operation and the window filtering operation by the plurality of processes, as the related interfaces are not adapted, the interface has the condition of call failure in the calling process, so that the abnormal condition of the desktop screen capturing operation is caused. Based on the method, the desktop screen capturing method based on window filtering is provided, and the problem of abnormal screen capturing caused by window filtering during desktop screen capturing is solved.
Embodiment one:
fig. 1 shows a flowchart of a desktop screen capturing method based on window filtering according to an embodiment of the present application, where the desktop screen capturing method based on window filtering according to the embodiment may be implemented by a desktop screen capturing device based on window filtering, where the desktop screen capturing device based on window filtering may be implemented by software and/or hardware, and the desktop screen capturing device based on window filtering may be formed by two or more physical entities or may be formed by one physical entity. Generally, the desktop screen capturing device based on window filtering can be a terminal device such as a computer, an intelligent large board, a tablet, a mobile phone and the like.
The following describes the desktop screen capturing device based on window filtering as a main body for executing the desktop screen capturing method based on window filtering. Referring to fig. 1, the desktop screen capturing method based on window filtering specifically includes:
s110, creating a main process, creating a sub-process based on the main process, and issuing a screen capturing instruction to the sub-process, wherein the screen capturing instruction comprises handle information of a designated window;
s120, collecting desktop images based on the subprocesses, filtering designated windows in the desktop images according to the handle information, generating desktop screen shots and sending the desktop screen shots to the main process, or sending screen shot abnormal information to the main process under the condition of abnormal screen shots;
s130, receiving the desktop screen capturing or the screen capturing abnormal information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing abnormal information is received.
When the desktop screen capturing operation is carried out, the dual processes are created through the screen capturing application to execute the desktop screen capturing operation containing window filtering. The screen capturing application creates a sub-process by using the main process through creating the main process, and performs desktop screen capturing and window filtering through the sub-process to obtain a screen capturing image meeting the requirement of a user. When the screen capturing operation is carried out by a single process, the resolution ratio switching may cause the process to crash, so that the screen capturing failure is caused. Therefore, the desktop screen capturing operation is executed through the main process and the starter process, and even when the sub-process screen capturing is abnormal, the main process can execute the desktop screen capturing operation again, so that the fault tolerance of the screen capturing operation is ensured. On the other hand, because the multi-process call is easy to cause call failure and cause abnormal screen capturing conditions, the embodiment of the application mainly uses a single process of the subprocess to execute desktop screen capturing and window filtering operations, and the main process is used for receiving the screen capturing result for storage or uploading. Therefore, reliability and stability of desktop screen capturing are guaranteed, and user experience is improved.
The following describes the scheme by taking the desktop screen capturing operation of the computer as an example. Specifically, when the desktop screen capturing is performed, the user performs man-machine interaction with the computer to trigger the desktop screen capturing function. The desktop screenshot function can be used for screenshot of the desktop or recording a video image of a segment of desktop screenshot. And the computer triggers the operation of the screen capturing application by responding to the interactive operation of the user. After the screen capturing application is started, a main process is firstly established, and desktop screen capturing operation is carried out by using the main process and a screwdriver process. The main process generates handle information of a designated window according to the designated window which needs to be filtered by the desktop, and further attaches the handle information to an instruction when a screen capturing instruction is issued to the sub-process, so that the sub-process can clearly determine the window position of the desktop screen capturing which needs to be filtered. As shown in FIG. 2, the main process creates an Inter-process communication link (i.e., IPC, inter-Process Communication) with the sub-process by creating the sub-process, issues a screen capture instruction and receives a screen capture result returned by the sub-process.
Before the method, the appointed window is preset according to the screen capturing content which is actually required to be filtered by the screen capturing application, and the subsequent main process can send handle information according to the preset appointed window when the desktop is captured, and instruct the subprocess to carry out the appointed window filtering operation. Where a Handle is an identifier that identifies an object or item and may be used to describe a form, file, etc. The problem of the memory management mechanism, i.e. the virtual address, is basically caused by setting up a handle for the Windows system. In short, since the address of data needs to be changed, and the change needs to be recorded and managed after the change, the system uses a handle to record the change of the data address. In programming, a handle is a special smart pointer that is used when an application is to reference a memory block or object managed by other systems (e.g., databases, operating systems). Based on the characteristic, when the subprocess carries out window filtering, the position of the window needing to be filtered can be accurately found by utilizing the handle information, and the part of display content is filtered.
Alternatively, the specified window may be a window type corresponding to the under-desktop requirement filtering or a display content corresponding to the desktop location. For example, in order to avoid content leakage for the corresponding window type during a desktop screenshot, it is desirable to avoid that part of the content from being intercepted for transmission. Based on the requirement, the display content of a certain window type displayed on the desktop can be filtered, and the part of the content is prevented from being stored or transmitted in a screen capturing mode. Similarly, for a control which does not need to be displayed in a certain part of the desktop screen capturing, in order to optimize the screen capturing display effect, the content displayed in the fixed position of the part is filtered.
When executing the screen capturing instruction issued by the main process, the subprocess further filters the filter window content at the indicated position of the corresponding handle information in the desktop image according to the handle information by collecting the desktop image, thereby obtaining the desktop image with the designated window content filtered. For example, when recording a screen desktop, control buttons of a system are also displayed on the screen, and pushing or recording requires the control buttons to be displayed. At the moment, the desktop image is acquired through the subprocess, then the position of the control button is found according to the handle information provided by the main process, and the control button on the desktop image is filtered, so that the desktop image in actual demand is obtained. And by analogy, the filtering operation is carried out on all desktop screen shots in the recording process, so that screen shot videos required by users can be obtained.
And for the subprocess, after the desktop image filtering is completed, the generated desktop screen capture is sent to the main process, and the main process stores or transmits the generated desktop screen capture, so that the whole desktop screen capture flow is completed. In addition, if the screen capturing process is abnormal, in order to ensure the screen capturing reliability, the subprocess sends abnormal information to the main process, and the main process re-executes the screen capturing operation of the desktop according to the abnormal information of the screen capturing process. Therefore, the reliability of desktop screen capturing is further guaranteed, the condition that screen capturing fails under abnormal conditions of screen capturing is further avoided, and the screen capturing experience of a user is improved.
Specifically, the main process is created based on a preset screen capturing application, and the screen capturing application is started through a system set display. When installing a screen capture application, it is necessary to assign the screen capture application to be opened only by the set display of the system. It should be noted that, in the case of multiple graphics cards, the independent graphics card is not adapted to the screen capturing application, which may cause a black screen in the screen capturing image. Therefore, by designating the open channel of the screen capturing application, the success rate of the screen capturing operation can be ensured, and unnecessary abnormal conditions can be avoided.
Further, the screen capturing anomaly information includes screen change anomaly information or screen capturing failure anomaly information. When the subprocess determines that the screen capturing is abnormal, screen change abnormal information or screen capturing failure abnormal information is generated according to different abnormal conditions of the screen capturing, and the corresponding screen capturing abnormal information is reported to the main process. And the main process performs screen capture exception processing according to different screen capture exception information so as to further improve the reliability and fault tolerance of desktop screen capture.
When the subprocess executes the screen capturing operation, a task queue of one thread is created in the subprocess, and the desktop image of the magnetic identification screen capturing is processed, as shown in fig. 3. The subprocess collects desktop images through initializing the magnifications, and sets handles of windows to be filtered. And further filtering the appointed window of the desktop image according to the handle information to obtain a corresponding desktop screen shot. After the operation is finished, the subprocess carries out logic judgment of the screen capturing abnormality, and whether the screen capturing abnormality occurs currently or not is confirmed.
Optionally, the subprocess determines screen capturing abnormality under the condition that the resolution of the screen changes before and after the desktop screen capturing operation, and sends the screen changing abnormality information to the main process. It will be appreciated that, due to the variation of the resolution of the screen, or in the case of multiple screens, the resolution of the main screen varies before and after the screen capture, which may result in different screen capture information before and after the screen capture, such as different widths and heights of the screen capture images. This can result in the generated screen shots failing to meet the user's needs. Based on the above, the sub-thread monitors the screen resolution and the main screen resolution before and after screen capturing, judges whether the screen resolution changes before and after screen capturing, and generates abnormal screen change information when the resolution changes (such as a user adjusts screen resolution parameters before and after screen capturing). And then sends this screen change abnormality information to the main process to handle the screen capture abnormality by the main process.
And for a main process, under the condition that the received screen capturing abnormal information is the screen changing abnormal information, clearing the current subprocess based on the main process, and reconstructing the subprocess to execute desktop screen capturing operation. Because of the screen capturing abnormality caused by the screen resolution change, a new subprocess can be recreated for desktop screen capturing operation by clearing the current subprocess. And re-monitor whether the screen resolution changes before and after the screen capture. By the method, screen capturing exception handling under the condition of screen change exception can be completed, and reliability of desktop screen capturing is guaranteed. Optionally, if the desktop screen capturing operation is performed by the repeated setting number reconstruction sub-process, a corresponding prompt can be output to inform the user of frequent change of the current screen resolution, so as to solve the frequent screen capturing abnormality through user intervention.
On the other hand, under the condition that the desktop screen capturing operation continuously fails for a set number of times, the subprocess determines the screen capturing abnormality and sends the abnormal information of the screen capturing failure to the main process. The subprocess judges whether the desktop screen capturing is successful or not by detecting whether the desktop screen capturing is successful or not, and if the situations such as screen capturing and the like occur, the screen capturing is considered to be failed. At this time, the subprocess continuously executes the desktop screen capturing process by referring to the original screen capturing mode. For example, the screen capturing operation is continuously performed 5 times, and whether the screen capturing is successful is detected in this process. If the screen capturing is successful, the current screen capturing operation is determined to be completed. Otherwise, if the screen capturing operation is continuously executed for 5 times and still fails, abnormal information of the screen capturing failure is sent to the main process so as to inform the current condition of the screen capturing failure. It can be understood that, for the situations of sub-thread initialization failure, display card driving failure, system abnormality, failure in interface call and the like, the failure of the screen capturing operation of the sub-thread is possibly caused, at this time, if the sub-thread is initialized, the problem of memory leakage and the like can be possibly caused, based on the fact, the method and the device notify the main thread of the abnormal screen capturing under the condition that the screen capturing operation is repeated for 5 times and still cannot be successfully captured, so that the main thread processes the abnormal screen capturing, and the success rate of the screen capturing operation is ensured.
And for the main process, switching to a default screen capturing mode to execute desktop screen capturing operation under the condition that the received screen capturing abnormal information is the screen capturing failure abnormal information. It can be appreciated that, considering that the normal screen capture cannot be obtained by using the identification capture mode at this time, the embodiment of the application provides a spam capture strategy, and the system default capture mode is switched to execute the desktop capture operation. The desktop screen shots that result at this time will include the content of the specified window.
By detecting different abnormal screen capturing conditions, the abnormal screen capturing is adaptively processed, so that a normal desktop screen capturing can be obtained for an end user, and the screen capturing experience of the user is ensured.
Finally, as shown in fig. 3, when the desktop screen capturing operation is successful, the sub-thread encodes the desktop screen capturing operation and converts the encoded desktop screen capturing operation into a video image in an H264 format. And so on, by executing the desktop screen capturing operation based on window filtering one by one, obtaining the desktop screen capturing of the desktop recorded video. The desktop screenshots are sent to a main process through an inter-process communication link, and the main process receives desktop screenshots for saving or transmitting so as to meet the use requirements under the corresponding scene.
In one embodiment, in order to further improve the desktop screen capturing efficiency, in the process of performing desktop screen capturing, the screen capturing application directly selects a default screen capturing mode to perform desktop screen capturing by detecting whether a designated window exists on the desktop or not and under the condition that the fact that the designated window does not exist on the current desktop is detected. And performing desktop window filtering by using a recognition screen capturing mode only when the fact that the designated window exists on the desktop is detected. The desktop screen capturing is performed by adaptively selecting the corresponding screen capturing mode, so that the screen capturing can be rapidly performed on a scene which does not need window filtering, and the user experience is further improved.
In addition, in one embodiment, for the desktop screen capturing which completes window filtering, the main process can also check the window filtering condition of the desktop screen capturing by calling a detection tool which is set, so as to judge whether the window is normally filtered. The detection tool can adopt an image detection mode, and if the image features of the appointed window exist on the desktop screen capture, the failure of the current desktop screen capture window filtration is indicated, and the desktop screen capture needs to be carried out again; otherwise, the current desktop screen capturing window is successfully filtered. By using the image detection mode, the window filtering result of the desktop screen capturing is accurately verified, and the more reliable and stable desktop screen capturing is realized.
Creating a subprocess based on the main process by creating the main process, and issuing a screen capturing instruction to the subprocess, wherein the screen capturing instruction comprises handle information of a designated window; collecting desktop images based on the subprocesses, filtering designated windows in the desktop images according to the handle information, generating desktop screen shots and sending the desktop screen shots to the main process, or sending screen shot abnormal information to the main process under the condition of abnormal screen shots; and receiving the desktop screen capturing or the screen capturing abnormal information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing abnormal information is received. By adopting the technical means, the main process is adopted to create the subprocess to perform desktop screen capturing operation, and when the screen capturing is abnormal, the desktop screen capturing operation is re-executed according to the abnormal information of the subprocess returned to the screen capturing, so that the abnormal condition of the screen capturing can be reduced, the stability and the reliability of the desktop screen capturing are improved, the condition that the screen capturing operation is inefficient or even fails due to repeated screen capturing abnormality is avoided, and the desktop screen capturing experience of a user is improved.
Embodiment two:
based on the above embodiments, fig. 4 is a schematic structural diagram of a desktop screen capturing device based on window filtering according to a second embodiment of the present application. Referring to fig. 4, the desktop screen capturing device based on window filtering provided in this embodiment specifically includes: a creation module 21, a screen capture module 22 and an exception handling module 23.
The creating module 21 is configured to create a main process, create a sub-process based on the main process, and issue a screen capturing instruction to the sub-process, where the screen capturing instruction includes handle information of a specified window;
the screen capturing module 22 is configured to collect a desktop image based on the sub-process, filter a specified window in the desktop image according to the handle information, generate a desktop screen capturing and send the desktop screen capturing to the main process, or send screen capturing abnormal information to the main process in case of abnormal screen capturing;
the exception handling module 23 is configured to receive a desktop screenshot or screenshot exception information based on the host process, and re-execute a desktop screenshot operation if the screenshot exception information is received.
Specifically, the screen capturing abnormality information includes screen change abnormality information or screen capturing failure abnormality information.
Under the condition that the resolution of the screen changes before and after the desktop screen capturing operation, determining that the screen capturing is abnormal, and sending screen change abnormal information to a main process;
and under the condition that the received screen capturing abnormal information is screen changing abnormal information, the current sub-process is cleared based on the main process, and a new sub-process is rebuilt to execute the desktop screen capturing operation.
And under the condition that the desktop screen capturing operation continuously fails for a set number of times, determining the screen capturing abnormality, and sending the abnormal information of the screen capturing failure to the main process.
And under the condition that the received screen capturing abnormal information is the screen capturing failure abnormal information, switching to a default screen capturing mode to execute desktop screen capturing operation.
In addition, the main process is created based on a preset screen capturing application, and the screen capturing application is started through system set display.
Creating a subprocess based on the main process by creating the main process, and issuing a screen capturing instruction to the subprocess, wherein the screen capturing instruction comprises handle information of a designated window; collecting desktop images based on the subprocesses, filtering designated windows in the desktop images according to the handle information, generating desktop screen shots and sending the desktop screen shots to the main process, or sending screen shot abnormal information to the main process under the condition of abnormal screen shots; and receiving the desktop screen capturing or the screen capturing abnormal information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing abnormal information is received. By adopting the technical means, the main process is adopted to create the subprocess to perform desktop screen capturing operation, and when the screen capturing is abnormal, the desktop screen capturing operation is re-executed according to the abnormal information of the subprocess returned to the screen capturing, so that the abnormal condition of the screen capturing can be reduced, the stability and the reliability of the desktop screen capturing are improved, the condition that the screen capturing operation is inefficient or even fails due to repeated screen capturing abnormality is avoided, and the desktop screen capturing experience of a user is improved.
The desktop screen capturing device based on window filtering provided in the second embodiment of the present application may be used to execute the desktop screen capturing method based on window filtering provided in the first embodiment, and has corresponding functions and beneficial effects.
Embodiment III:
an electronic device according to a third embodiment of the present application, referring to fig. 5, includes: processor 31, memory 32, communication module 33, input device 34 and output device 35. The number of processors in the electronic device may be one or more and the number of memories in the electronic device may be one or more. The processor, memory, communication module, input device, and output device of the electronic device may be connected by a bus or other means.
The memory is used as a computer readable storage medium for storing software programs, computer executable programs and modules, and program instructions/modules corresponding to the window filtering-based desktop screen capture method according to any embodiment of the present application (e.g., a creation module, a screen capture module and an exception handling module in a window filtering-based desktop screen capture device). The memory may mainly include a memory program area and a memory data area, wherein the memory program area may store an operating system, at least one application program required for a function; the storage data area may store data created according to the use of the device, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, the memory may further include memory remotely located with respect to the processor, the remote memory being connectable to the device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The communication module is used for carrying out data transmission.
The processor executes various functional applications of the device and data processing by running software programs, instructions and modules stored in the memory, namely, the desktop screen capturing method based on window filtering is realized.
The input means may be used to receive entered numeric or character information and to generate key signal inputs related to user settings and function control of the device. The output means may comprise a display device such as a display screen.
The electronic device provided by the above embodiment can be used for executing the desktop screen capturing method based on window filtering provided by the above embodiment, and has corresponding functions and beneficial effects.
Embodiment four:
embodiments also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing a window filtering-based desktop screen capture method comprising: creating a main process, creating a sub-process based on the main process, and issuing a screen capturing instruction to the sub-process, wherein the screen capturing instruction comprises handle information of a designated window; collecting desktop images based on the subprocesses, filtering designated windows in the desktop images according to the handle information, generating desktop screen shots and sending the desktop screen shots to the main process, or sending screen shot abnormal information to the main process under the condition of abnormal screen shots; and receiving the desktop screen capturing or the screen capturing abnormal information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing abnormal information is received.
Storage media-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk or tape devices; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, lanbas (Rambus) RAM, etc.; nonvolatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a second, different computer system connected to the first computer system through a network such as the internet. The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations (e.g., in different computer systems connected by a network). The storage medium may store program instructions (e.g., embodied as a computer program) executable by one or more processors.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present application is not limited to the desktop screen capturing method based on window filtering as described above, and may also perform the relevant operations in the desktop screen capturing method based on window filtering provided in any embodiment of the present application.
The desktop screen capturing device based on window filtering, the storage medium and the electronic device provided in the foregoing embodiments may perform the desktop screen capturing method based on window filtering provided in any embodiment of the present application, and technical details not described in detail in the foregoing embodiments may be referred to the desktop screen capturing method based on window filtering provided in any embodiment of the present application.
The foregoing description is only of the preferred embodiments of the present application and the technical principles employed. The present application is not limited to the specific embodiments described herein, but is capable of numerous obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the present application. Therefore, while the present application has been described in connection with the above embodiments, the present application is not limited to the above embodiments, but may include many other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the claims.
Claims (10)
1. A desktop screen capturing method based on window filtering, comprising:
creating a main process, creating a subprocess based on the main process, and issuing a screen capturing instruction to the subprocess, wherein the screen capturing instruction comprises handle information of a designated window;
collecting desktop images based on the subprocesses, filtering the designated windows in the desktop images according to the handle information, generating desktop screen shots and sending the desktop screen shots to the main process, or sending screen shot abnormal information to the main process under the condition of abnormal screen shots;
and receiving the desktop screen capturing or the screen capturing abnormal information based on the main process, and re-executing the desktop screen capturing operation under the condition that the screen capturing abnormal information is received.
2. The window filtering-based desktop screen capture method of claim 1, wherein the screen capture anomaly information comprises screen change anomaly information or screen capture failure anomaly information.
3. The window filtering-based desktop screen capture method according to claim 2, wherein in the case of a screen capture exception, sending screen capture exception information to the host process comprises:
and under the condition that the screen resolution is changed before and after the desktop screen capturing operation, determining the screen capturing abnormality, and sending the screen changing abnormality information to the main process.
4. The window filtering-based desktop screen capture method of claim 3, wherein the re-performing desktop screen capture operation in the case that the screen capture anomaly information is received comprises:
and under the condition that the received screen capturing abnormal information is the screen changing abnormal information, clearing the current subprocess based on the main process, and reconstructing the subprocess to execute desktop screen capturing operation.
5. The window filtering-based desktop screen capture method according to claim 2, wherein in the case of a screen capture exception, sending screen capture exception information to the host process comprises:
and under the condition that the desktop screen capturing operation continuously fails for a set number of times, determining screen capturing abnormality, and sending the abnormal information of the screen capturing failure to the main process.
6. The window filtering-based desktop screen capture method of claim 5, wherein the re-performing desktop screen capture operation if the screen capture anomaly information is received comprises:
and under the condition that the received screen capturing abnormal information is the screen capturing failure abnormal information, switching to a default screen capturing mode to execute desktop screen capturing operation.
7. The window filtering-based desktop screen capture method of claim 1, wherein the host process is created based on a preset screen capture application that is opened by a system set display.
8. A desktop screen capture device based on window filtering, comprising:
the creation module is used for creating a main process, creating a subprocess based on the main process, and sending a screen capturing instruction to the subprocess, wherein the screen capturing instruction comprises handle information of a designated window;
the screen capturing module is used for acquiring a desktop image based on the subprocess, filtering the appointed window in the desktop image according to the handle information, generating a desktop screen capturing and sending the desktop screen capturing to the main process, or sending screen capturing abnormal information to the main process under the condition of abnormal screen capturing;
and the exception handling module is used for receiving the desktop screen capturing or the screen capturing exception information based on the main process, and re-executing the desktop screen capturing operation under the condition of receiving the screen capturing exception information.
9. An electronic device, comprising:
a memory and one or more processors;
the memory is used for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the window filtering based desktop screen capture method of any of claims 1-7.
10. A storage medium containing computer executable instructions which, when executed by a computer processor, are for performing the window filtering based desktop screen capture method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311035644.XA CN117435313B (en) | 2023-08-16 | 2023-08-16 | Desktop screen capturing method, device, equipment and storage medium based on window filtering |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311035644.XA CN117435313B (en) | 2023-08-16 | 2023-08-16 | Desktop screen capturing method, device, equipment and storage medium based on window filtering |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117435313A true CN117435313A (en) | 2024-01-23 |
CN117435313B CN117435313B (en) | 2024-08-02 |
Family
ID=89545201
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311035644.XA Active CN117435313B (en) | 2023-08-16 | 2023-08-16 | Desktop screen capturing method, device, equipment and storage medium based on window filtering |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117435313B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015053051A (en) * | 2013-09-06 | 2015-03-19 | 株式会社リコー | System and method for switching screen display between multiple views using gesture |
CN109257317A (en) * | 2017-07-12 | 2019-01-22 | 武汉安天信息技术有限责任公司 | A kind of mobile Internet detection method for phishing site and device |
CN109684590A (en) * | 2018-12-25 | 2019-04-26 | 威创集团股份有限公司 | A kind of browsing device net page data sharing method and device |
WO2019228148A1 (en) * | 2018-05-31 | 2019-12-05 | 西安中兴新软件有限责任公司 | Image processing method and device, and storage medium |
-
2023
- 2023-08-16 CN CN202311035644.XA patent/CN117435313B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015053051A (en) * | 2013-09-06 | 2015-03-19 | 株式会社リコー | System and method for switching screen display between multiple views using gesture |
CN109257317A (en) * | 2017-07-12 | 2019-01-22 | 武汉安天信息技术有限责任公司 | A kind of mobile Internet detection method for phishing site and device |
WO2019228148A1 (en) * | 2018-05-31 | 2019-12-05 | 西安中兴新软件有限责任公司 | Image processing method and device, and storage medium |
CN109684590A (en) * | 2018-12-25 | 2019-04-26 | 威创集团股份有限公司 | A kind of browsing device net page data sharing method and device |
Also Published As
Publication number | Publication date |
---|---|
CN117435313B (en) | 2024-08-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11184542B2 (en) | Photographing apparatus control method, photographing apparatus and storage medium | |
CN113032080B (en) | Page implementation method, application program, electronic device and storage medium | |
US8902276B2 (en) | Computing device, storage medium, and method for controlling manipulation of the computing device | |
WO2023082613A1 (en) | Layer display method and apparatus | |
WO2019042473A1 (en) | Method and apparatus for operating touch display screen, terminal device, and storage medium | |
CN112911147A (en) | Display control method, display control device and electronic equipment | |
CN105630664B (en) | Reverse debugging method and device and debugger | |
CN117435313B (en) | Desktop screen capturing method, device, equipment and storage medium based on window filtering | |
CN110851303A (en) | Data backup method, system and equipment | |
WO2021043021A1 (en) | Memory write-back method and apparatus, and terminal and storage medium | |
CN111654674B (en) | Method, software system and terminal for processing multiple video sources in parallel based on single ffmpeg process | |
CN104284125A (en) | Multimedia shooting processing method, device and system | |
CN106851052B (en) | Control method and electronic equipment | |
CN108391120B (en) | Camera starting test method, device, equipment and storage medium | |
CN110737385A (en) | video mouse interaction method, intelligent terminal and storage medium | |
CN101547216A (en) | Safe storage method and system in process of real-time data acquisition | |
CN111711762B (en) | Camera lens module shielding control method and device based on target detection and camera | |
CN108984238A (en) | Gesture processing method, device and the electronic equipment of application program | |
CN116820634A (en) | Application processing device, control method, electronic device, and storage medium | |
CN108647097B (en) | Text image processing method and device, storage medium and terminal | |
CN112379952A (en) | Method for implementing cross-process callback | |
CN112394705B (en) | Method and device for processing exception of control program system parameters | |
CN110602416A (en) | Video processing method, terminal and computer readable storage medium | |
CN114884925B (en) | Method, device and system for transmitting composite photo data and electronic equipment | |
WO2019015089A1 (en) | Control method, device and apparatus for global menu, and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |