CN106547547B - data acquisition method and device - Google Patents

data acquisition method and device Download PDF

Info

Publication number
CN106547547B
CN106547547B CN201610906390.8A CN201610906390A CN106547547B CN 106547547 B CN106547547 B CN 106547547B CN 201610906390 A CN201610906390 A CN 201610906390A CN 106547547 B CN106547547 B CN 106547547B
Authority
CN
China
Prior art keywords
window
width
handle
function
calling
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.)
Active
Application number
CN201610906390.8A
Other languages
Chinese (zh)
Other versions
CN106547547A (en
Inventor
吕现广
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Kugou Computer Technology Co Ltd
Original Assignee
Guangzhou Kugou Computer Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangzhou Kugou Computer Technology Co Ltd filed Critical Guangzhou Kugou Computer Technology Co Ltd
Priority to CN201610906390.8A priority Critical patent/CN106547547B/en
Publication of CN106547547A publication Critical patent/CN106547547A/en
Application granted granted Critical
Publication of CN106547547B publication Critical patent/CN106547547B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The invention relates to a data acquisition method and a data acquisition device, and belongs to the technical field of data processing. The method comprises the following steps: calling a handle searching function, and searching a first window handle of the Flash control based on the first width and height of the Flash control; calling the handle searching function, and searching a second window handle of the Flash control based on a second width and height size of the Flash control, wherein the second width and height size is obtained by cutting the first width and height size; if the same handle exists in the first window handle and the second window handle, acquiring a third width-height size of a target Flash window identified by the same handle; and creating a bitmap according to the third width and height size, and copying the data displayed in the target Flash window into the created bitmap. According to the invention, all data displayed by the target Flash window are acquired and collected by searching the window handle, so that manpower and material resources consumed for developing different collection interfaces are saved, the operation is simple, and the data collection efficiency is improved.

Description

data acquisition method and device
Technical Field
The invention relates to the technical field of data processing, in particular to a data acquisition method and device.
Background
With the rapid development of internet technology, more and more functions can be realized by an operating system carried by a client. For example, the data acquisition function provided by the operating system may acquire data displayed in a Flash (animation editor) window according to an instruction of a home terminal user; the displayed data can be static data or dynamic data. And then, the operating system copies the collected data into the created bitmap to finish data collection. Furthermore, after the operating system finishes data acquisition, the bitmap is usually encoded and the encoded data is sent to the streaming media server through the client, so that the streaming media server decodes the encoded data and displays the data displayed in the Flash window to other users.
in the related art, when data is acquired, data displayed on a Flash window is rendered based on different rendering interfaces, for example, interfaces such as a Graphics Device Interface (GDI) and an Application Programming Interface (API), so that when an operating system acquires data, the operating system must acquire data rendered by using one rendering Interface by using an acquisition Interface matched with the rendering Interface. The collected data is then copied into the created bitmap.
Because different rendering interfaces are adopted to render data in the Flash window, different acquisition interfaces are required to acquire the data, so that the number of the interfaces required to be developed is large, and a large amount of manpower and material resources are consumed, so that the data acquisition mode is complex and tedious, the efficiency is not high, and the flexibility is poor.
disclosure of Invention
In order to overcome the problems in the related art, the invention provides a data acquisition method and a data acquisition device.
according to a first aspect of embodiments of the present invention, there is provided a data acquisition method, including:
Calling a handle searching function, and searching a first window handle of the Flash control based on the first width and height of the Flash control;
Calling the handle searching function, and searching a second window handle of the Flash control based on a second width and height size of the Flash control, wherein the second width and height size is obtained by cutting the first width and height size;
If the same handle exists in the first window handle and the second window handle, acquiring a third width-height size of a target Flash window identified by the same handle;
And creating a bitmap according to the third width and height size, and copying the data displayed in the target Flash window into the created bitmap.
optionally, the searching for the first window handle of the Flash control based on the first width-height size of the Flash control includes:
Calling a handle searching function, and acquiring a third process based on a first process and a second process currently running in an operating system, wherein the first process is a process where a window needing data acquisition is located;
saving the process identifier of the third process to a process identifier list;
Calling a first enumeration window function by taking a first callback function as a pointer, and acquiring a top-layer window which currently exists in the operating system;
acquiring a first top-layer window handle of the top-layer window in the first callback function;
Based on the first top-level window handle, taking the first callback function as a pointer, and calling an identification function to acquire a first top-level process identification of a process where the top-level window is located;
Acquiring a second top-level process identifier from the process identifier list based on the first top-level process identifier;
Based on the second top-level process identification and the first aspect size, the first window handle is looked up.
Optionally, the calling the handle lookup function, obtaining a third process based on the first process and a second process currently running in the operating system, and including:
Calling a process name acquisition function to acquire a first name of the first process;
Calling a process enumeration function, enumerating the second process, and acquiring a second name of the second process;
calling a first process judgment function and a second process judgment function, acquiring a third name associated with the first name from the second name, and acquiring a third process corresponding to the third name and a process identifier of the third process;
the handle search function includes the process name obtaining function, the process enumeration function, the first process judgment function, and the second process judgment function.
Optionally, the searching for the first window handle based on the second top-level process identifier and the first width and height size includes:
acquiring a second top-level window handle based on the second top-level process identifier;
calling a second enumeration window function by taking a second callback function as a pointer, and acquiring a child window handle in the second callback function based on the second top-layer window handle;
calling a window rectangular function, acquiring a fourth width and height size of the child window handle, and comparing the fourth width and height size with the first width and height size;
acquiring a fifth width and height dimension which is the same as the first width and height dimension in the fourth width and height dimension;
and taking the sub-window handle corresponding to the fifth width and height size as the first window handle.
optionally, the calling the handle lookup function, and based on the second width, height, and size of the Flash control, looking up the second window handle of the Flash control includes:
Calling the window rectangle function, and comparing the fourth width and height size with the second width and height size;
Acquiring a sixth width and height dimension which is the same as the second width and height dimension in the fourth width and height dimension;
And taking the sub-window handle corresponding to the sixth width and height as the second window handle.
optionally, the copying the data displayed in the target Flash window into the created bitmap includes:
Calling a window interception function, and copying the content displayed in the target Flash window;
and pasting the content displayed in the target Flash window to the created bitmap to finish data acquisition operation.
Optionally, the method further comprises:
if the same handle does not exist in the first window handle and the second window handle, generating a search failure notification message;
And sending the search failure notification message to the Flash control.
according to a second aspect of embodiments of the present invention, there is provided a data acquisition apparatus comprising:
The first calling module is used for calling a handle searching function and searching a first window handle of the Flash control based on the first width and height of the Flash control;
The first calling module is further configured to call the handle searching function, and search a second window handle of the Flash control based on a second width and height size of the Flash control, where the second width and height size is obtained by clipping the first width and height size;
The acquisition module is used for acquiring a third width and height size of a target Flash window identified by the same handle if the same handle exists in the first window handle and the second window handle;
And the copying module is used for creating a bitmap according to the third width and height size and copying the data displayed in the target Flash window into the created bitmap.
Optionally, the first calling module includes:
the calling unit is used for calling the handle searching function and acquiring a third process based on a first process and a second process currently running in the operating system, wherein the first process is a process where a window needing data acquisition is located;
A saving unit, configured to save the process identifier of the third process to a process identifier list;
the calling unit is further configured to call a first enumeration window function by using the first callback function as a pointer, and obtain a currently existing top-level window in the operating system;
A first obtaining unit, configured to obtain, in the first callback function, a first top-level window handle of the top-level window;
the calling unit is further configured to call an identification function to obtain a first top-level process identification of a process in which the top-level window is located, based on the first top-level window handle and with the first callback function as a pointer;
a second obtaining unit, configured to obtain a second top-level process identifier from the process identifier list based on the first top-level process identifier;
A searching unit, configured to search the first window handle based on the second top-level process identifier and the first width and height size.
Optionally, the calling unit is further configured to call a process name obtaining function to obtain a first name of the first process; calling a process enumeration function, enumerating the second process, and acquiring a second name of the second process; calling a first process judgment function and a second process judgment function, acquiring a third name associated with the first name from the second name, and acquiring a third process corresponding to the third name and a process identifier of the third process; the handle search function includes the process name obtaining function, the process enumeration function, the first process judgment function, and the second process judgment function.
Optionally, the searching unit is configured to obtain a second top-level window handle based on the second top-level process identifier; calling a second enumeration window function by taking a second callback function as a pointer, and acquiring a child window handle in the second callback function based on the second top-layer window handle; calling a window rectangular function, acquiring a fourth width and height size of the child window handle, and comparing the fourth width and height size with the first width and height size; acquiring a fifth width and height dimension which is the same as the first width and height dimension in the fourth width and height dimension; and taking the sub-window handle corresponding to the fifth width and height size as the first window handle.
optionally, the first calling module is further configured to call the window rectangle function, and compare the fourth width and height size with the second width and height size; acquiring a sixth width and height dimension which is the same as the second width and height dimension in the fourth width and height dimension; and taking the sub-window handle corresponding to the sixth width and height as the second window handle.
Optionally, the copying module is configured to call a window capture function, and copy the content displayed in the target Flash window; and pasting the content displayed in the target Flash window to the created bitmap to finish data acquisition operation.
optionally, the apparatus further comprises:
a generating module, configured to generate a search failure notification message if the same handle does not exist in the first window handle and the second window handle;
and the sending module is used for sending the search failure notification message to the Flash control.
the technical scheme provided by the embodiment of the invention can have the following beneficial effects:
the operating system calls a handle searching function, and searches a first window handle of the Flash control based on the first width and height of the Flash control; then, the operating system continuously calls the handle searching function, and searches a second window handle of the Flash control based on a second width and height size obtained by cutting the first width and height size by the Flash control; comparing the first window handle with the second window handle, and if the same handle exists in the first window handle and the second window handle, acquiring a third width and height size of the target Flash window identified by the same handle; and the operating system creates a bitmap according to the third width and height dimensions, and copies the data displayed in the target Flash window into the created bitmap to complete the data acquisition operation. According to the method, the window handle is searched, all data displayed by the target Flash window are obtained and collected, all the displayed data are copied into the created bitmap, and different collection interfaces are not needed for data collection, so that manpower and material resources consumed for developing different collection interfaces are saved, the operation is simple and easy, the flexibility is good, and the data collection efficiency is improved.
it is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow chart illustrating a method of data acquisition according to an exemplary embodiment;
FIG. 2 is a flow chart illustrating a method of data acquisition according to an exemplary embodiment;
FIG. 3A is a block diagram illustrating a data acquisition device according to an exemplary embodiment;
FIG. 3B is a block diagram illustrating a data acquisition device according to an exemplary embodiment;
FIG. 3C is a block diagram illustrating a data acquisition device according to an exemplary embodiment;
FIG. 4 is a block diagram illustrating a data acquisition device according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
Fig. 1 is a flow chart illustrating a data acquisition method according to an exemplary embodiment, as shown in fig. 1, including the following steps.
In step 101, a handle search function is called to search a first window handle of a Flash control based on a first width and height size of the Flash control.
In step 102, the handle lookup function is called, and a second window handle of the Flash control is looked up based on a second width and height size of the Flash control, wherein the second width and height size is obtained by cutting the first width and height size.
in step 103, if the same handle exists in the first window handle and the second window handle, the third width and height size of the target Flash window identified by the same handle is obtained.
in step 104, a bitmap is created according to the third width and height size, and the data displayed in the target Flash window is copied to the created bitmap.
according to the method provided by the embodiment of the invention, an operating system calls a handle searching function, and searches a first window handle of a Flash control based on the first width and height of the Flash control; then, the operating system continuously calls the handle searching function, and searches a second window handle of the Flash control based on a second width and height size obtained by cutting the first width and height size by the Flash control; comparing the first window handle with the second window handle, and if the same handle exists in the first window handle and the second window handle, acquiring a third width and height size of the target Flash window identified by the same handle; and the operating system creates a bitmap according to the third width and height dimensions, and copies the data displayed in the target Flash window into the created bitmap to complete the data acquisition operation. According to the method, the window handle is searched, all data displayed by the target Flash window are obtained and collected, all the displayed data are copied into the created bitmap, and different collection interfaces are not needed for data collection, so that manpower and material resources consumed for developing different collection interfaces are saved, the operation is simple and easy, the flexibility is good, and the data collection efficiency is improved.
Optionally, searching for a first window handle of the Flash control based on the first width, height, and size of the Flash control includes:
calling a handle searching function, and acquiring a third process based on a first process and a second process currently running in an operating system, wherein the first process is a process where a window needing data acquisition is located;
saving the process identifier of the third process to a process identifier list;
Calling a first enumeration window function by taking the first callback function as a pointer, and acquiring a top-layer window which currently exists in the operating system;
In the first callback function, acquiring a first top-layer window handle of the top-layer window;
based on the first top-level window handle, the first callback function is taken as a pointer, and an identification function is called to obtain a first top-level process identification of the process where the top-level window is located;
Acquiring a second top-level process identifier from the process identifier list based on the first top-level process identifier;
Based on the second top-level process identification and the first aspect size, the first window handle is looked up.
optionally, calling a handle lookup function, and acquiring a third process based on the first process and a second process currently running in the operating system, including:
calling a process name acquisition function to acquire a first name of the first process;
Calling a process enumeration function, enumerating the second process, and acquiring a second name of the second process;
Calling a first process judgment function and a second process judgment function, acquiring a third name associated with the first name from the second name, and acquiring a third process corresponding to the third name and a process identifier of the third process;
The handle search function includes the process name obtaining function, the process enumeration function, the first process judgment function and the second process judgment function.
Optionally, searching for the first window handle based on the second top-level process identifier and the first width and height size includes:
Acquiring a second top-level window handle based on the second top-level process identifier;
calling a second enumeration window function by taking a second callback function as a pointer, and acquiring a child window handle in the second callback function based on the second top-layer window handle;
Calling a window rectangular function, acquiring a fourth width and height size of the child window handle, and comparing the fourth width and height size with the first width and height size;
acquiring a fifth width and height dimension which is the same as the first width and height dimension in the fourth width and height dimension;
And taking the sub-window handle corresponding to the fifth width and height size as the first window handle.
optionally, calling the handle lookup function, and looking up a second window handle of the Flash control based on the second width, height, and size of the Flash control, including:
calling the window rectangle function, and comparing the fourth width and height size with the second width and height size;
Acquiring a sixth width and height dimension which is the same as the second width and height dimension in the fourth width and height dimension;
And taking the sub-window handle corresponding to the sixth width and height size as the second window handle.
optionally, copying the data shown in the target Flash window into the created bitmap includes:
calling a window interception function, and copying the content displayed in the target Flash window;
And pasting the content displayed in the target Flash window to the created bitmap to complete data acquisition operation.
Optionally, the method further comprises:
if the same handle does not exist in the first window handle and the second window handle, generating a search failure notification message;
and sending the search failure notification message to the Flash control.
All the above-mentioned optional technical solutions can be combined arbitrarily to form the optional embodiments of the present invention, and are not described herein again.
Fig. 2 is a flowchart illustrating a data collection method according to an exemplary embodiment, where an execution subject of the data collection method is an operating system installed on a terminal, and at least one browser can run on the operating system, and the operating system includes a Flash control and a video collection component, and data collection is implemented through interaction between the Flash control and the video collection component. The video acquisition component is a component based on a browser interface (an ActiveX component interface is adopted by an IE system browser, and PPAPI interfaces are adopted by chord and Firefox system browsers). As shown in fig. 2, the data acquisition method includes the following steps.
In step 201, the Flash control calls a window handle preparation function of the video capture component through the scripting language, so that the video capture component prepares for searching a window handle of a target Flash window.
In the embodiment of the invention, the Flash control calls the function of the video acquisition component for preparing and searching the window handle through the script language so as to complete the initialization of the video acquisition component, so that the video acquisition component prepares all functions possibly involved in the data acquisition process and informs the video acquisition component to prepare for receiving the parameters to be sent by the Flash control.
In step 202, the Flash control sends the first width and height to the video capture component, and calls a process name obtaining function of the video capture component through the scripting language, so that the video capture component obtains a first name of a first process, calls a process enumeration function, enumerates a second process, and obtains a second name of the second process.
in the embodiment of the present invention, the process obtaining function may be a function GetModuleFileName, the process enumeration function may be a function createtolhelp 32Snapshot, the first process is a process where a window that needs data acquisition is located, and the second process is all processes running in the current operating system; the process name obtaining function can obtain a first name of a first process where a target Flash window is located according to the target Flash window selected by a user, and then the process enumeration function can enumerate a second process by checking all processes running in a current background. If there are more than one second process enumerated by the process enumeration function, a process name list may be maintained for the second process, and the second name of each process in the second process is stored in the process name list. The embodiment of the present invention does not specifically limit the types of the process acquisition function and the process enumeration function and the number of enumerated second processes.
in step 203, the video capture component invokes the first process determination function and the second process determination function, obtains a third process associated with the first name in the second name, and stores a process identifier of the third process in the process identifier list.
in the embodiment of the present invention, the First Process determination function may be a function Process32First, and the second Process determination function may be a function Process32 Next. For example, if the second name is stored in the process name list, the first process judgment function is called to match the first second name in the process name list with the first name; judging whether the first second name is associated with the first name or not; if the first second name is associated with the first name, acquiring a third process corresponding to the first second name, and storing a process identifier of the third process into a process identifier list; and if the first second name is not associated with the first name, skipping the first second name and not storing. And after the judgment of the first second name is finished, calling a second process judgment function to obtain the next second name in the window name list, and judging again until all the second names in the window name list are judged.
Note that, since the process names of different processes may be the same, for example, process 1, process 2, and process3 are from a series of products of a product line, such as a music box, a live room, and a personal space, respectively, where a indicates the name of the product line. The process names of the three processes are set to be the same, for example, named as x. Therefore, the process 1 is associated with the processes 2 and 3, that is, the name of one process is the same as that of the other process, that is, there is an association; in other words, in the embodiment of the present invention, if a second name is the same as the first name, it is determined that the second name is associated with the first name.
In step 204, the video capture component calls a first enumeration window function with the first callback function as a pointer to obtain all top-level windows existing in the current operating system, then obtains a first top-level window handle of the top-level window in the first callback function, and calls an identification function to obtain a first top-level process identification of the top-level window based on the first top-level window handle.
in this embodiment of the present invention, the first enumeration window function may be an engine windows function, and the identification function may be a getwindowthreadprocess id function. The first enumeration window function needs to acquire all top-level windows existing in the current operating system, and acquire first top-level window handles of all top-level windows in the first callback function; and then, taking the first top-level window handles as parameters, and calling an identification function to obtain a first top-level process identification of a process of the window corresponding to each first top-level window handle.
for example, if top-level windows existing in the current operating system are respectively a, B, C, and D, then the first top-level window handle of the obtained top-level window a is 0001, the first top-level window handle of the top-level window B is 0002, the first top-level window handle of the top-level window C is 0003, and the first top-level window handle of the top-level window D is 0004, the first top-level window handles 0001, 0002, 0003, and 0004 are respectively used as parameters to call the identification function to obtain the first top-level process identifiers of the top-level window a, the top-level window B, the top-level window C, and the top-level window D.
In step 205, the video capture component obtains a second top-level process identifier from the process identifier list based on the first top-level process identifier, obtains a second top-level window handle based on the second top-level process identifier, then calls a second enumeration window function with a second callback function as a pointer, and obtains a child window handle in the second callback function based on the second top-level window handle.
In this embodiment of the present invention, the second enumeration window function may be an enum child windows function, and the video capture component obtains all process identifiers in the process identifier list and compares all process identifiers with the first top-level process identifier. And if the first top-level process identifier is matched with a second top-level process identifier in all the process identifiers, acquiring a second top-level window handle corresponding to the second top-level process identifier. Wherein, the second top window identification can be one or more; thereafter, a top-level window handle list may be maintained for the second top-level window handle, and the resulting second top-level window handle saved to the top-level window handle list.
and the video component calls a second enumeration window function by taking the second callback function as a pointer and taking each top window handle in the top window handle list as a parameter, and acquires the child window handles of the child windows included in the top window corresponding to each top window handle in the second callback function until each top window handle in the top window handle list is traversed.
in step 206, the video capture component calls a window rectangle function to obtain a fourth width-height size of the sub-window handle, compares the fourth width-height size with the first width-height size, then obtains a fifth width-height size in the fourth width-height size, which is the same as the first width-height size, and uses the sub-window handle corresponding to the fifth width-height size as the first window handle.
In the embodiment of the present invention, the window rectangular function may be a function GetWindowRect, the video acquisition component calls the window rectangular function with the sub-window handle as a parameter, obtains a fourth width and height size of the sub-window corresponding to the sub-window handle, compares the fourth width and height size with the first width and height size sent by the Flash control, and uses the sub-window handle corresponding to the fourth width and height size which is the same as the first width and height size as the first window handle. The video capture component may then maintain a first list of candidate window handles for the first window handle and save the first window handle to the first list of candidate window handles. The number of the first window handles may be one or more, which is not specifically limited in this embodiment of the present invention.
in step 207, the Flash control sends the second width and height size to the video capture component, and calls the window rectangular function of the video component again through the scripting language, so that the video capture component compares the fourth width and height size with the second width and height size, then obtains a sixth width and height size in the fourth width and height size, which is the same as the second width and height size, and takes a sub-window handle corresponding to the sixth width and height size as the second window handle.
In the embodiment of the invention, the video acquisition component sends the notification message to the Flash control after the first window handle is searched, so that the Flash control knows that the video acquisition component has finished searching the first window handle. And then, the Flash control cuts the size of the Flash control according to the preset setting to generate a second width and height size, wherein the preset setting can be height increase, width increase, height decrease and width decrease, and the embodiment of the invention is not specifically limited in this respect.
the video capture component may maintain a second candidate window handle list for the second window handle and save the second window handle to the second candidate window handle list. The number of the second window handles may be one or more, which is not specifically limited in this embodiment of the present invention.
it should be noted that after the second window handle is searched, the video capture component sends a notification message to the Flash control again, so that the Flash control knows that the video capture component has finished searching the second window handle, and then the Flash control adjusts and restores the current second width-height size to the first width-height size to maintain the attributes of the Flash control.
in step 208, the Flash control calls an end search window handle function of the video acquisition component through the scripting language to compare the first window handle with the second window handle; if the same handle exists in the first window handle and the second window handle, the video acquisition component acquires a third width-height size of the target Flash window identified by the same handle, and executes the following step 209; and if the same handle does not exist in the first window handle and the second window handle, the video acquisition component generates a search failure notification message and sends the search failure notification message to the Flash control.
in the embodiment of the present invention, taking the above-mentioned maintaining of the first candidate window handle list and the second candidate window handle list as an example, each window handle in the first candidate window handle list is compared with each window handle in the second candidate window handle list; and if the same handle does not exist, the video acquisition component generates a search failure notification message, the notification mode of the message can be an event notification mode, and the search failure notification message is sent to the Flash control.
and the Flash control generates a failure prompt after receiving the search failure notification message, displays the failure prompt to the user, and provides the user with a contact way of the technical developer so that the user can contact the technical developer. It should be noted that, in the embodiment of the present invention, the failure probability of the video capture component in searching for the target Flash window is close to zero.
It should be noted that there is a possibility that the window sizes of the process windows are the same, and therefore, when searching for the first window handle, a plurality of window handles of the process windows having the same width and height as the first window handle may be found. The Flash control cuts the size of the Flash control, so that the first width and height size and the second width and height size which are sent to the video acquisition are different, and other windows with the same size as the Flash control cannot be changed at the same time, so that the same handle is the window handle of the target Flash window in the first window handle and the second window handle as long as the same handle exists.
in step 209, the video capture component creates a bitmap according to the third width and height dimensions, invokes a window capture function, copies the content displayed in the target Flash window, and pastes the content displayed in the target Flash window to the created bitmap to complete the data capture operation.
The window intercept function may be a PrintWindow function, and the type of the window intercept function is not specifically limited in the embodiment of the present invention. The video acquisition component creates a bitmap with the third width and height as parameters, and calls a window capture function to paste all contents displayed in the target Flash window into the created bitmap, and for the contents in the target Flash window copied by the video acquisition component, the contents can be dynamic contents or static contents.
according to the method provided by the embodiment of the invention, an operating system calls a handle searching function, and searches a first window handle of a Flash control based on the first width and height of the Flash control; then, the operating system continuously calls the handle searching function, and searches a second window handle of the Flash control based on a second width and height size obtained by cutting the first width and height size by the Flash control; comparing the first window handle with the second window handle, and if the same handle exists in the first window handle and the second window handle, acquiring a third width and height size of the target Flash window identified by the same handle; and the operating system creates a bitmap according to the third width and height dimensions, and copies the data displayed in the target Flash window into the created bitmap to complete the data acquisition operation. According to the method, the window handle is searched, all data displayed by the target Flash window are obtained and collected, all the displayed data are copied into the created bitmap, and different collection interfaces are not needed for data collection, so that manpower and material resources consumed for developing different collection interfaces are saved, the operation is simple and easy, the flexibility is good, and the data collection efficiency is improved.
FIG. 3 is a block diagram illustrating a data acquisition device according to an exemplary embodiment. Referring to fig. 3A, the apparatus includes a first calling module 301, an obtaining module 302, and a copying module 303.
the first calling module 301 is configured to call a handle searching function, and search a first window handle of a Flash control based on a first width, a first height, and a first size of the Flash control;
the first calling module 301 is further configured to call the handle lookup function, and lookup a second window handle of the Flash control based on a second width and height size of the Flash control, where the second width and height size is obtained by clipping the first width and height size;
the obtaining module 302 is configured to obtain a third width and height size of the target Flash window identified by the same handle if the same handle exists in the first window handle and the second window handle;
The copying module 303 is configured to create a bitmap according to the third width and height size, and copy the data displayed in the target Flash window into the created bitmap.
optionally, referring to fig. 3B, the first calling module 301 includes a calling unit 3011, a saving unit 3012, a first obtaining unit 3013, a second obtaining unit 3014, and a searching unit 3015.
The calling unit 3011 is configured to call a handle lookup function, and obtain a third process based on a first process and a currently running second process, where the first process is a process in which a window that needs to perform data acquisition is located;
the saving unit 3012, configured to save the process identifier of the third process to a process identifier list;
The calling unit 3011 is further configured to call a first enumeration window function by using the first callback function as a pointer, and obtain a currently existing top-level window in the operating system;
The first obtaining unit 3013, configured to obtain, in the first callback function, a first top-level window handle of the top-level window;
the calling unit 3011 is further configured to call an identifier function to obtain a first top-level process identifier of a process in which the top-level window is located, based on the first top-level window handle and using the first callback function as a pointer;
The second obtaining unit 3014, configured to obtain, based on the first top-level process identifier, a second top-level process identifier in the process identifier list;
The lookup unit 3015 is configured to lookup the first window handle based on the second top-level process identifier and the first aspect size.
Optionally, the calling unit 3011 is further configured to call a process name obtaining function to obtain a first name of the first process; calling a process enumeration function, enumerating the second process, and acquiring a second name of the second process; calling a first process judgment function and a second process judgment function, acquiring a third name associated with the first name from the second name, and acquiring a third process corresponding to the third name and a process identifier of the third process; the handle search function includes the process name obtaining function, the process enumeration function, the first process judgment function and the second process judgment function.
optionally, the lookup unit 3015 is configured to obtain a second top-level window handle based on the second top-level process identifier; calling a second enumeration window function by taking a second callback function as a pointer, and acquiring a child window handle in the second callback function based on the second top-layer window handle; calling a window rectangular function, acquiring a fourth width and height size of the child window handle, and comparing the fourth width and height size with the first width and height size; acquiring a fifth width and height dimension which is the same as the first width and height dimension in the fourth width and height dimension; and taking the sub-window handle corresponding to the fifth width and height size as the first window handle.
Optionally, the first calling module 301 is further configured to call the window rectangle function, and compare the fourth width and height size with the second width and height size; acquiring a sixth width and height dimension which is the same as the second width and height dimension in the fourth width and height dimension; and taking the sub-window handle corresponding to the sixth width and height size as the second window handle.
optionally, the copying module 303 is configured to call a window capture function, and copy the content displayed in the target Flash window; and pasting the content displayed in the target Flash window to the created bitmap to complete data acquisition operation.
optionally, referring to fig. 3C, the apparatus further includes a generating module 304 and a sending module 305.
the generating module 304 is configured to generate a search failure notification message if the same handle does not exist in the first window handle and the second window handle;
The sending module 305 is configured to send the search failure notification message to the Flash control.
According to the device provided by the embodiment of the invention, an operating system calls a handle searching function, and searches a first window handle of a Flash control based on the first width and height of the Flash control; then, the operating system continuously calls the handle searching function, and searches a second window handle of the Flash control based on a second width and height size obtained by cutting the first width and height size by the Flash control; comparing the first window handle with the second window handle, and if the same handle exists in the first window handle and the second window handle, acquiring a third width and height size of the target Flash window identified by the same handle; and the operating system creates a bitmap according to the third width and height dimensions, and copies the data displayed in the target Flash window into the created bitmap to complete the data acquisition operation. According to the method, the window handle is searched, all data displayed by the target Flash window are obtained and collected, all the displayed data are copied into the created bitmap, and different collection interfaces are not needed for data collection, so that manpower and material resources consumed for developing different collection interfaces are saved, the operation is simple and easy, the flexibility is good, and the data collection efficiency is improved.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 4 is a block diagram illustrating a data acquisition device 400 according to an exemplary embodiment. For example, the apparatus 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
referring to fig. 4, the apparatus 400 may include one or more of the following components: processing component 402, memory 404, power component 406, multimedia component 408, audio component 410, interface to I/O (Input/Output) 412, sensor component 414, and communication component 416.
The processing component 402 generally controls overall operation of the apparatus 400, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 402 can include one or more modules that facilitate interaction between the processing component 402 and other components. For example, the processing component 402 can include a multimedia module to facilitate interaction between the multimedia component 408 and the processing component 402.
The memory 404 is configured to store various types of data to support operations at the apparatus 400. Examples of such data include instructions for any application or method operating on the device 400, contact data, phonebook data, messages, pictures, videos, and so forth. The Memory 404 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as an SRAM (Static Random Access Memory), an EEPROM (Electrically-Erasable Programmable Read-Only Memory), an EPROM (Erasable Programmable Read-Only Memory), a PROM (Programmable Read-Only Memory), a ROM (Read-Only Memory), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
power supply components 406 provide power to the various components of device 400. The power components 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the apparatus 400.
the multimedia component 408 includes a screen that provides an output interface between the device 400 and the user. In some embodiments, the screen may include an LCD (Liquid Crystal Display) and a TP (touch panel). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the apparatus 400 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
the audio component 410 is configured to output and/or input audio signals. For example, the audio component 410 may include a Microphone (MIC) configured to receive external audio signals when the device 400 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 404 or transmitted via the communication component 416. In some embodiments, audio component 410 also includes a speaker for outputting audio signals.
the I/O interface 412 provides an interface between the processing component 402 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 414 includes one or more sensors for providing various aspects of status assessment for the apparatus 400. For example, the sensor component 414 can detect the open/closed state of the device 400, the relative positioning of components, such as a display and keypad of the apparatus 400, the sensor component 414 can also detect a change in the position of the apparatus 400 or a component of the apparatus 400, the presence or absence of user contact with the apparatus 400, orientation or acceleration/deceleration of the apparatus 400, and a change in the temperature of the apparatus 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 414 may also include a light sensor, such as a CMOS (Complementary Metal oxide semiconductor) or CCD (Charge-coupled Device) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
the communication component 416 is configured to facilitate wired or wireless communication between the apparatus 400 and other devices. The apparatus 400 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 416 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the Communication component 416 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on an RFID (Radio frequency identification) technology, an IrDA (infrared-Data Association) technology, an UWB (Ultra Wideband) technology, a BT (Bluetooth) technology, and other technologies.
In an exemplary embodiment, the apparatus 400 may be implemented by one or more ASICs (Application Specific Integrated circuits), DSPs (Digital signal processors), DSPDs (Digital signal processing devices), PLDs (Programmable logic devices), FPGAs (Field Programmable Gate arrays), controllers, microcontrollers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 404 comprising instructions, executable by the processor 420 of the apparatus 400 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a RAM (Random Access Memory), a CD-ROM (Compact Disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium having instructions therein which, when executed by a processor of a data acquisition apparatus, enable the data acquisition apparatus to perform the above data acquisition method.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (12)

1. a method of data acquisition, the method comprising:
Calling a handle searching function, and searching a first window handle of a Flash control based on the first width and height of the Flash control of the animation editor;
Calling the handle searching function, and searching a second window handle of the Flash control based on a second width and height size of the Flash control, wherein the second width and height size is obtained by cutting the first width and height size;
if the same handle exists in the first window handle and the second window handle, acquiring a third width-height size of a target Flash window identified by the same handle;
creating a bitmap according to the third width and height size, and copying data displayed in the target Flash window into the created bitmap;
The searching for the first window handle of the Flash control based on the first width and height of the Flash control comprises: calling a handle search function, and acquiring a third process based on a first process and a second process currently running in an operating system, wherein the first process is a process where a window needing data acquisition is located, and the third process is a process in which a name in the second process is associated with a first name of the first process; saving the process identifier of the third process to a process identifier list; calling a first enumeration window function by taking a first callback function as a pointer, and acquiring a top-layer window which currently exists in the operating system; acquiring a first top-layer window handle of the top-layer window in the first callback function; based on the first top-level window handle, taking the first callback function as a pointer, and calling an identification function to acquire a first top-level process identification of a process where the top-level window is located; acquiring a second top-level process identifier from the process identifier list based on the first top-level process identifier; based on the second top-level process identification and the first aspect size, the first window handle is looked up.
2. The method of claim 1, wherein invoking the handle lookup function to obtain a third process based on the first process and a second process currently running in the operating system comprises:
Calling a process name acquisition function to acquire the first name;
Calling a process enumeration function, enumerating the second process, and acquiring a second name of the second process;
calling a first process judgment function and a second process judgment function, acquiring a third name associated with the first name from the second name, and acquiring a third process corresponding to the third name and a process identifier of the third process;
the handle search function includes the process name obtaining function, the process enumeration function, the first process judgment function, and the second process judgment function.
3. the method of claim 1, wherein finding the first window handle based on the second top-level process identification and the first aspect size comprises:
Acquiring a second top-level window handle based on the second top-level process identifier;
Calling a second enumeration window function by taking a second callback function as a pointer, and acquiring a child window handle in the second callback function based on the second top-layer window handle;
Calling a window rectangular function, acquiring a fourth width and height size of the child window handle, and comparing the fourth width and height size with the first width and height size;
Acquiring a fifth width and height dimension which is the same as the first width and height dimension in the fourth width and height dimension;
and taking the sub-window handle corresponding to the fifth width and height size as the first window handle.
4. the method of claim 3, wherein the invoking the handle lookup function to lookup a second window handle of the Flash control based on a second aspect size of the Flash control comprises:
Calling the window rectangle function, and comparing the fourth width and height size with the second width and height size;
Acquiring a sixth width and height dimension which is the same as the second width and height dimension in the fourth width and height dimension;
and taking the sub-window handle corresponding to the sixth width and height as the second window handle.
5. The method according to any one of claims 1 to 4, wherein the copying of the data presented in the target Flash window into the created bitmap comprises:
calling a window interception function, and copying the content displayed in the target Flash window;
and pasting the content displayed in the target Flash window to the created bitmap to finish data acquisition operation.
6. the method of claim 1, further comprising:
If the same handle does not exist in the first window handle and the second window handle, generating a search failure notification message;
and sending the search failure notification message to the Flash control.
7. a data acquisition device, the device comprising:
the first calling module is used for calling a handle searching function and searching a first window handle of the Flash control based on the first width and height of the Flash control;
the first calling module is further configured to call the handle searching function, and search a second window handle of the Flash control based on a second width and height size of the Flash control, where the second width and height size is obtained by clipping the first width and height size;
the acquisition module is used for acquiring a third width and height size of a target Flash window identified by the same handle if the same handle exists in the first window handle and the second window handle;
A copying module for creating a bitmap according to the third width and height size and copying the data displayed in the target Flash window into the created bitmap
The first calling module comprises: the device comprises a calling unit, a processing unit and a processing unit, wherein the calling unit is used for calling a handle searching function and acquiring a third process based on a first process and a second process currently running in an operating system, the first process is a process where a window needing data acquisition is located, and the third process is a process in which a name in the second process is associated with a first name of the first process; a saving unit, configured to save the process identifier of the third process to a process identifier list; the calling unit is further configured to call a first enumeration window function by using the first callback function as a pointer, and obtain a currently existing top-level window in the operating system; a first obtaining unit, configured to obtain, in the first callback function, a first top-level window handle of the top-level window; the calling unit is further configured to call an identification function to obtain a first top-level process identification of a process in which the top-level window is located, based on the first top-level window handle and with the first callback function as a pointer; a second obtaining unit, configured to obtain a second top-level process identifier from the process identifier list based on the first top-level process identifier; a searching unit, configured to search the first window handle based on the second top-level process identifier and the first width and height size.
8. the apparatus according to claim 7, wherein the calling unit is configured to call a process name obtaining function to obtain a first name of the first process; calling a process enumeration function, enumerating the second process, and acquiring a second name of the second process; calling a first process judgment function and a second process judgment function, acquiring a third name associated with the first name from the second name, and acquiring a third process corresponding to the third name and a process identifier of the third process; the handle search function includes the process name obtaining function, the process enumeration function, the first process judgment function, and the second process judgment function.
9. the apparatus of claim 7, wherein the lookup unit is configured to obtain a second top-level window handle based on the second top-level process identifier; calling a second enumeration window function by taking a second callback function as a pointer, and acquiring a child window handle in the second callback function based on the second top-layer window handle; calling a window rectangular function, acquiring a fourth width and height size of the child window handle, and comparing the fourth width and height size with the first width and height size; acquiring a fifth width and height dimension which is the same as the first width and height dimension in the fourth width and height dimension; and taking the sub-window handle corresponding to the fifth width and height size as the first window handle.
10. The apparatus of claim 9, wherein the first calling module is further configured to call the window rectangle function, and compare the fourth width and height size with the second width and height size; acquiring a sixth width and height dimension which is the same as the second width and height dimension in the fourth width and height dimension; and taking the sub-window handle corresponding to the sixth width and height as the second window handle.
11. the apparatus according to any one of claims 7 to 10, wherein the copying module is configured to invoke a window intercept function to copy the content displayed in the target Flash window; and pasting the content displayed in the target Flash window to the created bitmap to finish data acquisition operation.
12. The apparatus of claim 7, further comprising:
A generating module, configured to generate a search failure notification message if the same handle does not exist in the first window handle and the second window handle;
and the sending module is used for sending the search failure notification message to the Flash control.
CN201610906390.8A 2016-10-18 2016-10-18 data acquisition method and device Active CN106547547B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610906390.8A CN106547547B (en) 2016-10-18 2016-10-18 data acquisition method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610906390.8A CN106547547B (en) 2016-10-18 2016-10-18 data acquisition method and device

Publications (2)

Publication Number Publication Date
CN106547547A CN106547547A (en) 2017-03-29
CN106547547B true CN106547547B (en) 2019-12-10

Family

ID=58369210

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610906390.8A Active CN106547547B (en) 2016-10-18 2016-10-18 data acquisition method and device

Country Status (1)

Country Link
CN (1) CN106547547B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763298A (en) * 2018-04-19 2018-11-06 华东师范大学 A kind of increment sampling algorithm for window function row modes
CN109324844A (en) * 2018-09-30 2019-02-12 武汉斗鱼网络科技有限公司 A kind of method, apparatus and computer equipment at detection window interface
CN110717136B (en) * 2019-10-09 2022-11-18 浙江中控技术股份有限公司 Monitoring picture WEB publishing method, device and system
CN111857929B (en) * 2020-07-23 2023-05-30 杭州海康威视数字技术股份有限公司 Method and device for displaying application program interface and computer equipment
CN112269886B (en) * 2020-11-11 2021-05-25 游密科技(深圳)有限公司 Shared image acquisition method, window sharing method and shared image acquisition device
CN112540903B (en) * 2020-12-11 2022-07-05 武汉斗鱼鱼乐网络科技有限公司 Method, storage medium, electronic device and system for quickly searching for multi-open prevention

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064704A (en) * 2012-12-19 2013-04-24 中国人民解放军第二炮兵装备研究院第四研究所 Software window product life-cycle management method based on process identification
CN104679555A (en) * 2015-01-30 2015-06-03 广州市赛普电子科技有限公司 Method and system for embedding PPT (power point) by aid of third-party software
CN105550112A (en) * 2015-12-17 2016-05-04 北京海泰方圆科技股份有限公司 Browser rendering capability test method
CN105607900A (en) * 2015-11-26 2016-05-25 小米科技有限责任公司 Display object processing method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064704A (en) * 2012-12-19 2013-04-24 中国人民解放军第二炮兵装备研究院第四研究所 Software window product life-cycle management method based on process identification
CN104679555A (en) * 2015-01-30 2015-06-03 广州市赛普电子科技有限公司 Method and system for embedding PPT (power point) by aid of third-party software
CN105607900A (en) * 2015-11-26 2016-05-25 小米科技有限责任公司 Display object processing method and apparatus
CN105550112A (en) * 2015-12-17 2016-05-04 北京海泰方圆科技股份有限公司 Browser rendering capability test method

Also Published As

Publication number Publication date
CN106547547A (en) 2017-03-29

Similar Documents

Publication Publication Date Title
CN106547547B (en) data acquisition method and device
CN106569800B (en) Front-end interface generation method and device
CN109032606B (en) Native application compiling method and device and terminal
CN104462296B (en) File management method and device and terminal
CN107193606B (en) Application distribution method and device
CN106201734B (en) File sharing method and device
CN109710259B (en) Data processing method, device and storage medium
CN107220059B (en) Application interface display method and device
CN107402767B (en) Method and device for displaying push message
CN107463372B (en) Data-driven page updating method and device
US11210449B2 (en) Page display method and device and storage medium
CN111061452A (en) Voice control method and device of user interface
CN114741292A (en) Test script management method and device, electronic equipment and storage medium
CN104951522B (en) Method and device for searching
CN105468606B (en) Webpage saving method and device
CN107402756B (en) Method, device and terminal for drawing page
CN111695064B (en) Buried point loading method and device
CN111338971B (en) Application testing method and device, electronic equipment and storage medium
CN105260088B (en) Information classification display processing method and device
CN109491655B (en) Input event processing method and device
CN107679205B (en) Multimedia data playing method and device, computer equipment and storage medium
CN112486617B (en) Ciphertext data processing architecture, method, apparatus and machine readable medium
CN110457084B (en) Loading method and device
CN105827854B (en) Operation processing method and device
CN105607958B (en) Information input method and device

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 510660 Guangzhou City, Guangzhou, Guangdong, Whampoa Avenue, No. 315, self - made 1-17

Applicant after: Guangzhou KuGou Networks Co., Ltd.

Address before: 510000 B1, building, No. 16, rhyme Road, Guangzhou, Guangdong, China 13F

Applicant before: Guangzhou KuGou Networks Co., Ltd.

GR01 Patent grant
GR01 Patent grant