Screen grab technology reveals ---------- In-depth Windows internal adventure, Zhengzhou Ma Fei Tao, open it! Users of the four-way distribution and Jinshan tyrants have seen the screen grabbing technology. Which words are translated to translate, this technology seems simple, in fact, it is very complex and interesting in the Windows system. After more than half a year of hardships, the author finally cracked the secrets and decided to open it today. This person has seen the secrets, but there are so many secrets, this is only publicly disclosed by several software companies. The newspaper information discloses the secrets of only words! Recalling more than half a year of exploration, which infiltrates how many people's depression and joy, despair and excitement, setback and gain, now there is final results: the secret openness of the screen grabbing technology, dedicated to the programs that are not tired and hard work . If this is the power of the domestic software industry, it is also a quick thing for the author! Second, first knowledge screen grabs the word, I first knew that the screen grabbed, after purchasing the English-Han Tong Software. At that time, the author was only a practitioner of Visual Basic, and there is not much knowledge of the knowledge inside the Windows system. It is considered that the implementation of the screen grip in the Windows system should be the same as the DOS system, and call a DOS interrupt on the screen or It is possible to read the contents of the memory directly. Three seemings very simple, it is not possible to discover the problem is not as simple as the understanding of the WINDOWS system. First, read thousands of functions in the WinodWS Application Interface (API), do not find an outgoing function similar to getWordFromPoint (); according to experience, it is not an image recognition technology that is judged by judging the screen grabbing. The online document of the SDK is not covered in the online document of the SDK; it is difficult to obtain the information of the card programming interface, and some are only the basic knowledge of CGA to VGA. Recalling that the online information (if it is paper, it will be piled up like a mountain), and it feels that it is in the dark, there is no direction, there is no light, but strong interest is close to me. Be sure to unlock this mystery. Four Selecting the appropriate programming tools Suddenly have some new ideas: Can you try to intercept the message about characters in Windows? What is DC (Device Description Table)? Whether the textOut function of Windows puts Text in a unit of DC? Obviously, it is not from the heart with Visual Basic. In DOS, use Turbo C to program the author, so try to use Visual C , but the chronic compilation speed makes people unbearable, high abstract classes make people misty water, develop business software may be ok, but develop such A system piece inside Windows, looking at a bunch of entangled classes and news, really a bit of cow knife, bayonet, farming. Finally, I chose Delphi. The first impression is that the compilation speed is really fast. In my grandfather 386 machine, I have a Windows program, the speed and the speed of Turbo C feel almost, really exciting to love. With the continuous use, I found that Delphi is a good rapid development tool (fast does not mean simple and rough, but the performance of the Windows system has a mixed-in interface) to make beginners easy to get started.
The various Windows functions (including many undisclosed functions) are very straightforward, with it to make developing tools, big bayonets see red, a sword sealing throat. The five-way poor water has no way, with the in-depth of the Windows system, I gradually understood that when you output text to the screen, the Windo WS system is just sending a WM_PAINT message for an application, telling the application window user area already "invalid" Need to redraw. Specific "Draw" work (select font, color, text) is done by the application. Applications When processing the WM_Paint message, call BeginPaint and EndPaint to get and release the device descriptom, call DrawText, EXTTEXTOUT, Textout, etc. "Draw" in the device description table. Application "Draw" text, like students (Applications) Draft (WM_PAINT Message) with brush provided by Teacher (DrawText EXTTEXTOUT TEXTOUT, etc.), although everyone can see what is painted? Word, but brush as a drawing tool, I don't know what it is. Teacher (Windows) does not know what fonts, color, and painting of students (applications). In short, Windows doesn't know what the application "draw" is. "Text" is only a chalk print on the blackboard (screen) for Windo WS, just the traces of painting. "Text" only exists in the module of the application, the Windows system is "invisible". I have no way to go everywhere, I really want to 掂 5,000 yuan, run to "Han Tong" company to buy this secret. Think carefully, too little money is 10 times more, people don't necessarily say. Liu Liu Diachi also a village after thinking three, I associate with the programming in the DOS system, it will change the interrupt vector address, set up new interrupt vectors: If the system calls this interrupt, you will first enter the new interrupt service program, then The original interrupt service program is called again. At that end, this technology is also taken in the Windows system, so that if a function is called, advance into a tracking function, obtain the parameters of the original function, and then call the original function. Sounds whether there is a virus infection and episode? In fact, many programs have used similar techniques. I used it when I graduated the sound card. At this point, I realize that there should be a conventional idea, take some skills, intercepting the Textout, EXTTEXTOUT and other functions, turn it to my trace function, check the application (student) stack to the brush (TextOut, ExtTextout " The parameters of the application, to obtain "text" written on the screen. Seven "screen grip" is implemented with SETWINDOWSHOKEX () Install the mouse hook mouseproc; 2 When moving the mouse on the screen, the system will call the mouse hook mouseproc; 3 Enter MouseProc, get the mouse coordinates (X, Y), set the pair Tracking programs such as TextOut (), EXTTEXTOUT (), tell the system with invalidateect () This point (x, y) "fail"; 4 system issues a WM_PAINT message, indicating the application redrawn at the point (x, y) " The area of failure.