Method and device for obtaining visible area of target window and computer equipment

Through dot matrix scanning and the removal of stacked window areas, the problem of inefficient acquisition of visible areas in the target window in traditional methods is solved, and efficient acquisition of visible areas in windows is achieved.

CN119987913APending Publication Date: 2025-05-13CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411804271.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

When multiple windows are stacked on each other, it is difficult for traditional methods to efficiently acquire visible areas of the target window, resulting in inefficient processing.

Method used

Scan the target window by lattice to quickly eliminate the covered window area, thereby efficiently obtaining the visible area of ​​the target window. The specific steps include obtaining the target window area, scanning the area with dot matrix, judging the window handle of the scanning point, removing the overlapping part of the stacked window area, and completing the scanning of the entire target window area.

Benefits of technology

This method improves the efficiency of obtaining visible areas of the target window, and overcomes the problems of enumerating windows in traditional methods that consume time, consume a lot of resources, and are difficult to obtain window cascade relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987913A_ABST
    Figure CN119987913A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of IT and software development, and discloses a method and device for obtaining a visible area of a target window and computer equipment, and the method comprises the following steps: S1, obtaining a target window area; s2, performing dot matrix scanning on the target window area; s3, judging whether a window handle corresponding to the coordinates of the current scanning point is a handle of a target window or not, and when the window handle is not the handle of the target window, obtaining a stacked window area corresponding to the handle; s4, removing the overlapped part of the laminated window area and the target window area from the target window area; and S5, returning to the step S2 to continue scanning until scanning of the whole target window area is completed. By implementing the method, the visible area of the target window can be quickly and efficiently obtained in real time with low resource consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of IT and software development technology, and in particular to a method, a device and a computer device for acquiring a visible area of ​​a target window. Background Art

[0002] In the regular window usage / display of a regular system desktop, with the increasing frequency of daily desktop applications, especially when the number of processes running in the system and the number of windows on the desktop are relatively large, multiple windows are stacked on top of each other, and the position of each window may change frequently, how to instantly, quickly and efficiently obtain the visible area of ​​the target window has become a very common demand.

[0003] However, in the process of controlling multiple overlapping windows for data display in traditional solutions, there are disadvantages such as enumerating desktop windows is time-consuming and consumes machine performance, and it is difficult to obtain the hierarchical relationship between windows, resulting in inefficient acquisition of the visible area of ​​the target window. Summary of the invention

[0004] In view of this, the present invention provides a method, an apparatus and a computer device for obtaining a visible area of ​​a target window, so as to solve the problem of low processing efficiency for obtaining the visible area of ​​a target window.

[0005] In a first aspect, the present invention provides a method for obtaining a visible area of ​​a target window, the method comprising:

[0006] S1, obtain the target window area;

[0007] S2, performing a dot matrix scan on the target window area;

[0008] S3, determining whether the window handle corresponding to the coordinates of the current scanning point is the handle of the target window, and when the window handle is not the handle of the target window, obtaining the stacked window area corresponding to the handle;

[0009] S4, removing the overlapping portion of the stacked window area and the target window area from the target window area;

[0010] S5, return to step S2 to continue scanning until the scanning of the entire target window area is completed.

[0011] The present invention provides a method for obtaining the visible area of ​​a target window, which is based on dot matrix scanning of the target window and quickly excludes the covered window area to efficiently obtain the visible area of ​​the target window, overcoming the defects of the traditional method of enumerating desktop windows, such as low efficiency, relatively high consumption of system resources, relatively difficult to obtain the window stacking relationship, or the need to inject a plug-in into the target window process, which affects the stability of the target process.

[0012] In an optional implementation, the acquiring the target window area includes:

[0013] Get the rectangle of the target window;

[0014] Converts the target window's rectangle to the target window area.

[0015] In an optional implementation, the performing dot matrix scanning on the target window area includes:

[0016] Establishing a rectangular coordinate system with the upper left corner of the target window area as the origin;

[0017] Taking the origin of the rectangular coordinate system as the starting point, scanning is performed from left to right in the horizontal direction and from top to bottom in the vertical direction.

[0018] In an optional implementation, before executing step S3, the method further includes:

[0019] Determine whether the current scanning point is within the target window area;

[0020] If the current scanning point is within the target window area, execute step S3;

[0021] If the current scanning point is not within the target window area, return to step S2.

[0022] In an optional embodiment, the method further includes:

[0023] When the window handle is the handle of the target window, return to step S2.

[0024] In an optional implementation, the method further includes: setting the scanning matrix to a square or a diamond.

[0025] In a second aspect, the present invention provides a device for obtaining a visible area of ​​a target window, the device comprising:

[0026] An acquisition module is used to acquire a target window area;

[0027] A scanning module, used for performing dot matrix scanning on the target window area;

[0028] A judging module, used for judging whether the window handle corresponding to the coordinates of the current scanning point is the handle of the target window, and when the window handle is not the handle of the target window, obtaining the stacked window area corresponding to the handle;

[0029] A removal module, used for removing the overlapping portion of the stacked window area and the target window area from the target window area;

[0030] The return module is used to return to the scanning module to continue scanning until the scanning of the entire target window area is completed.

[0031] The present invention provides a device for obtaining the visible area of ​​a target window, which is based on dot matrix scanning of the target window and quickly excludes the covered window area to efficiently obtain the visible area of ​​the target window, overcoming the defects of the traditional method of enumerating desktop windows, such as low efficiency, relatively high consumption of system resources, relatively difficult to obtain the window stacking relationship, or the need to inject a plug-in into the target window process, which affects the stability of the target process.

[0032] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method for obtaining the visible area of ​​the target window of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0033] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for obtaining a visible area of ​​a target window according to the first aspect or any corresponding embodiment thereof.

[0034] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the method for obtaining a visible area of ​​a target window in the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 is a flow chart of a method for obtaining a visible area of ​​a target window according to an embodiment of the present invention;

[0037] Figure 2 is a schematic diagram of a window rectangle according to an embodiment of the present invention;

[0038] Figure 3 is a flow chart of another method for obtaining a visible area of ​​a target window according to an embodiment of the present invention;

[0039] Figure 4 is a rectangular schematic diagram of a target window according to an embodiment of the present invention;

[0040] Figure 5 is a rectangular schematic diagram of another target window according to an embodiment of the present invention;

[0041] Figure 6 is a schematic diagram of a scanning matrix optimization solution according to an embodiment of the present invention;

[0042] Figure 7 is a structural block diagram of a device for obtaining a visible area of ​​a target window according to an embodiment of the present invention;

[0043] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0045] Taking the PC desktop platform as an example, the conventional method of instantly obtaining the visible area of ​​the target window has the disadvantages of being time-consuming and consuming machine performance to enumerate the desktop windows, and being difficult to obtain the hierarchical relationship between windows, resulting in inefficiency in obtaining the visible area of ​​the target window.

[0046] The following is an example of using Visual C++ programming in Windows platform. The commonly used methods to obtain the visible area of ​​the desktop window are as follows:

[0047] 1. A method of enumerating window information by calling the system API: "BOOL EnumWindows(WNDENUMPROC lpEnumFunc, LPARAMlParam);". This method can enumerate all visible / invisible windows created on the current desktop, and pass the window information to the caller through the lpEnumFunc callback function set by the system call. The callback parameter only provides the window handle, and if real-time window information needs to be obtained, the API needs to be called frequently. However, this method has problems such as poor performance (relatively time-consuming), high consumption of system resources (relatively high CPU consumption), and inability to obtain the stacking order of windows.

[0048] 2. In order to optimize the problem of poor performance caused by frequent enumeration of window information due to the need to obtain window position information in real time in method 1, the window subclassing (SetWindowLong(hwnd,GWL_WNDPROC,(LONG)UserWndProc);) method can be used to intercept whether the current process window is moved and then update the position information of the cascaded window in method 1 in real time. However, the premise of window subclassing is that the current process must be subclassed, because the subclassing of the window cannot be called across processes. At this time, in order to implement window subclassing, the program needs to be made into a plug-in (such as DLL) and then injected into all processes with interfaces in the system in the form of a global hook. However, any global hook that needs to inject the current plug-in into other processes involves the stability of program operation. That is, if this method is adopted, it is very easy to cause stability problems in process operation under the system.

[0049] Based on this, it is necessary to provide a method and system for processing content displayed in overlapping windows to address the technical problem that in the process of traditional solutions for controlling multiple overlapping windows for data display, the processing efficiency of obtaining the visible area of ​​the target window is low.

[0050] According to an embodiment of the present invention, a method embodiment for obtaining a visible area of ​​a target window is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0051] In this embodiment, a method for obtaining a visible area of ​​a target window is provided, which can be used in the above-mentioned mobile terminal, such as a mobile phone, a tablet computer, etc. Figure 1 is a flow chart of a method for obtaining a visible area of ​​a target window according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0052] Step S1, obtaining a target window area.

[0053] Specifically, the rectangle mentioned in the following embodiments is composed of the left, top, right, and bottom coordinates of the position of a window to describe the position information of a window. The area mentioned in the following embodiments is the block combination result obtained by merging or XORing multiple regular rectangles (RECT). The area corresponding to the intersection is determined as the overlapping area, and the area corresponding to the non-intersection is determined as the non-overlapping area. In the overlapping area, the window hierarchy of each display window is detected, and the first-layer window and non-first-layer window of the overlapping area are determined according to the window hierarchy. The overlapping area of ​​the first-layer window is determined as the visible area of ​​the corresponding display window, and the overlapping area of ​​the non-first-layer window is determined as the non-visible area of ​​the corresponding display window. The visible area of ​​the target window represents the non-overlapping area in the target display window and the first-layer window area in the overlapping area.

[0054] by Figure 2 For example, the RECT of window 1 is Rect1, the RECT of window 2 is Rect2, and the RECT of window 3 is Rect3. If you want to get the visible area of ​​window 1, the target window area is Rect1. The visible area of ​​window 1 is the area obtained by XORing Rect1 with Rect2, that is, the result after removing the overlapping part of Rect1 and Rect2 on the basis of Rect1 (the shadow part of window 1).

[0055] Step S2, performing a dot matrix scan on the target window area.

[0056] Specifically, Rect1 is dot-scanned from left to right and from top to bottom.

[0057] Step S3, determining whether the window handle corresponding to the coordinates of the current scanning point is the handle of the target window, and when the window handle is not the handle of the target window, obtaining the stacked window area corresponding to the handle.

[0058] Specifically, during the scanning process, it is determined whether the window handle corresponding to the coordinates of the current scanning point is the handle of the target window. When the window handle is the handle of the target window, it means that the current scanning point position is not covered by other windows, and then return to step S2 to continue the next scan. If the obtained window handle is not the handle of the target window, it means that the current scanning point position has been covered by other windows. At this time, the RECT of the stacked window is obtained through the handle, and then the RECT of the stacked window is converted into the corresponding window area.

[0059] In the embodiment of the present invention, the handle corresponding to the coordinates can be obtained by passing in POINT through the windows system API: "windowFromPoint". The RECT of the stacked window can be obtained through the windows system API: "GetWindowRect".

[0060] Step S4: remove the overlapping portion of the stacked window area and the target window area from the target window area.

[0061] Specifically, the overlapping part of the stacked window area and the target window area is removed from the target window area by XOR combination to obtain a new target window area. In the embodiment of the present invention, the XOR combination operation is performed by the API of the windows system: "CombineRgn".

[0062] Step S5, returning to step S2 to continue scanning until the scanning of the entire target window area is completed.

[0063] Specifically, when it is determined that the current scanning point position is not covered by other windows, the scanning is directly returned to step S2 to continue. When it is determined that the current scanning point position is covered by other windows, the target window area is updated, and the scanning is also returned to step S2 to continue. The process of the method for obtaining the visible area of ​​the target window is as follows Figure 3 The method proposed in this application plays a great role in the application of quickly rendering the target visible window in the development of Windows desktop applications, because the project requires real-time acquisition of the visible area of ​​the target window and then real-time rendering operations. In actual scenarios, there may be other visible desktop windows that move and cover the target window. In order to have a good user experience, it is necessary to obtain the visible area of ​​the target window in real time and perform real-time refresh and rendering operations.

[0064] The present invention provides a method for obtaining the visible area of ​​a target window, which is based on dot matrix scanning of the target window and quickly excludes the covered window area to efficiently obtain the visible area of ​​the target window, overcoming the defects of the traditional method of enumerating desktop windows, such as low efficiency, relatively high consumption of system resources, relatively difficult to obtain the window stacking relationship, or the need to inject a plug-in into the target window process, which affects the stability of the target process.

[0065] In an optional implementation, step S1 includes:

[0066] Step S11, obtaining the rectangle of the target window.

[0067] Step S12, converting the rectangle of the target window into a target window area.

[0068] Specifically, first obtain the rectangle (RECT) of the target window, which is the area of ​​the scan target. Then obtain the corresponding target window area based on this RECT. Specifically, you can use the Windows system API: "CreateRectRgn" to obtain the corresponding target window area based on RECT.

[0069] by Figure 2For example, first get Rect1, and then convert Rect1 to the corresponding Region through the Windows system API: "CreateRectRgn".

[0070] In an optional implementation, step S2 includes:

[0071] Step S21, establishing a rectangular coordinate system with the upper left corner of the target window area as the origin.

[0072] Step S22, starting from the origin of the rectangular coordinate system, scanning from left to right in the horizontal direction and from top to bottom in the vertical direction.

[0073] Specifically, Figure 4 As shown, a rectangular coordinate system is established with the upper left corner of the target window area as the starting point, where the horizontal direction is the x-axis and the vertical direction is the y-axis. Starting from the origin of the rectangular coordinate system, the scanning dot matrix is ​​scanned from left to right horizontally and from top to bottom vertically, with a spacing of 50 pixels. First, the scanned dot matrix range must be within the range of the rectangular frame and will not exceed the range of the rectangular frame. This can greatly reduce the range of the target area we need to scan, reduce unnecessary area scanning, and improve the scanning efficiency.

[0074] In an optional implementation, before executing step S3, the method further includes:

[0075] Step S4, determining whether the current scanning point is within the target window area.

[0076] Step S5: If the current scanning point is within the target window area, execute step S3.

[0077] Step S6: If the current scanning point is not within the target window area, return to step S2.

[0078] Specifically, during the scanning process, it is constantly determined whether the coordinate position of the current scanning point is within the target window area. If the current scanning point is within the target window area, then step S3 is continued. If the current scanning point is not within the target window area, the subsequent steps are skipped and the scanning is directly returned to step S2 to be re-scanned. This can reduce the scanning area range and exclude the covered area range, which can improve the scanning efficiency to a certain extent.

[0079] In the embodiment of the present invention, it is determined whether the coordinate position of the current scanning point is within the target window region through the system API: "PtInRegion".

[0080] In an optional implementation, the method further includes: setting the scanning matrix to a square or a diamond.

[0081] Specifically, the scan matrix can be set as follows Figure 4 For example, if the scan matrix width is 50 pix, then the scan matrix is ​​actually a 50*50 square. When the scan matrix is ​​set to a square, if the height or width of a strip window is less than 50 pix, the dot matrix scan may ignore the covered strip window because the scan point cannot cover the strip window area. Figure 5 As shown. To this end, the scanning matrix is ​​optimized from a square to a diamond scanning matrix, that is, the dot matrix with even numbers in the horizontal direction is adjusted 25pix downward in the y-axis direction. Figure 6 As shown in the figure, after the transformation, the vertical dot interval is still 50pix, and the horizontal dot interval is changed from 50pix to 100pix. By optimizing the scanning matrix from a square to a diamond scanning matrix, it is possible to avoid missing the judgment of the common horizontal or vertical strip rectangular cover window to the greatest extent with almost the same number of scanning matrix points.

[0082] In the embodiment of the present invention, real-time scanning of non-fixed coordinate point matrices can be performed at the same time, which can also minimize the omission of some smaller covered windows; and matrix boundary scanning operations can be performed on the four boundaries of the target window at the same time to avoid the problem that the window boundary is partially covered and not covered by the scanning points. At the same time, the density of the scanning matrix can be modified according to actual conditions to adjust the algorithm execution efficiency and the omission tolerance of the scanning window, thereby greatly improving the user experience.

[0083] In the present embodiment, a device for obtaining the visible area of ​​the target window is also provided, and the device is used to implement the above-mentioned embodiment and the preferred implementation mode, and the description thereof has been made no further. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0084] This embodiment provides a device for obtaining a visible area of ​​a target window, such as Figure 7 As shown, including:

[0085] The acquisition module 71 is used to acquire the target window area.

[0086] The scanning module 72 is used to perform dot matrix scanning on the target window area.

[0087] The judgment module 73 is used to judge whether the window handle corresponding to the coordinates of the current scanning point is the handle of the target window. When the window handle is not the handle of the target window, the stacked window area corresponding to the handle is obtained.

[0088] The removal module 74 is used to remove the overlapping portion of the stacked window area and the target window area from the target window area.

[0089] The return module 75 is used to return to the scanning module to continue scanning until the scanning of the entire target window area is completed.

[0090] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0091] The device for obtaining the visible area of ​​the target window in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0092] The present invention provides a device for obtaining the visible area of ​​a target window, which is based on dot matrix scanning of the target window and quickly excludes the covered window area to efficiently obtain the visible area of ​​the target window, overcoming the defects of the traditional method of enumerating desktop windows, such as low efficiency, relatively high consumption of system resources, relatively difficult to obtain the window stacking relationship, or the need to inject a plug-in into the target window process, which affects the stability of the target process.

[0093] The embodiment of the present invention also provides a computer device having the above Figure 7 The device shown is for obtaining the visible area of ​​the target window.

[0094] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0095] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0096] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0097] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0098] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0099] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.

[0100] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0101] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0102] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0103] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for obtaining a visible area of ​​a target window, characterized in that: The method comprises: S1, obtain the target window area; S2, performing a dot matrix scan on the target window area; S3, determining whether the window handle corresponding to the coordinates of the current scanning point is the handle of the target window, and when the window handle is not the handle of the target window, obtaining the stacked window area corresponding to the handle; S4, removing the overlapping portion of the stacked window area and the target window area from the target window area; S5, return to step S2 to continue scanning until the scanning of the entire target window area is completed.

2. The method for obtaining the visible area of ​​a target window according to claim 1, characterized in that: The step of obtaining the target window area includes: Get the rectangle of the target window; Converts the target window's rectangle to the target window area.

3. The method for obtaining the visible area of ​​a target window according to claim 1, characterized in that: The step of performing dot matrix scanning on the target window area comprises: Establishing a rectangular coordinate system with the upper left corner of the target window area as the origin; Taking the origin of the rectangular coordinate system as the starting point, scanning is performed from left to right in the horizontal direction and from top to bottom in the vertical direction.

4. The method for obtaining the visible area of ​​a target window according to claim 1, characterized in that: Before executing step S3, the method further includes: Determine whether the current scanning point is within the target window area; If the current scanning point is within the target window area, execute step S3; If the current scanning point is not within the target window area, return to step S2.

5. The method for obtaining the visible area of ​​a target window according to claim 1, characterized in that: The method further comprises: When the window handle is the handle of the target window, return to step S2.

6. The method for obtaining the visible area of ​​a target window according to claim 1, characterized in that: The method further includes: setting the scanning matrix to be a square or a diamond.

7. A device for obtaining a visible area of ​​a target window, characterized in that: The device comprises: An acquisition module is used to acquire a target window area; A scanning module, used for performing dot matrix scanning on the target window area; A judgment module, used for judging whether the window handle corresponding to the coordinates of the current scanning point is the handle of the target window, and when the window handle is not the handle of the target window, obtaining the stacked window area corresponding to the handle; A removal module, used for removing the overlapping portion of the stacked window area and the target window area from the target window area; The return module is used to return to the scanning module to continue scanning until the scanning of the entire target window area is completed.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for obtaining the visible area of ​​a target window according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for obtaining a visible area of ​​a target window according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the method for obtaining a visible area of ​​a target window according to any one of claims 1 to 6.