Teach you to use VC6 to do QQ pair of pairs

xiaoxiao2021-03-06  37

Some time to play QQ games with the previous colleagues, the result is good, and the result is so bad. Later, I saw there is an external hanging on the Internet, but I still need to register, I will consider why I can write it, why can't I write it? ? So I spent an afternoon, I studied it carefully and hang it out. In fact, the principle is simple, just save the data above the chessboard, and then you can know where the animals move, then you can click two locations by simulating the mouse message. 1) Get the data of the chessboard data to obtain the data of the chessboard, the idea is this: First, you have to get the pair of windows, and then analyze the pixels above the window to get the data in each lattice. For animals in each lattice, there must be several characteristic points that can distinguish the animals in each lattice, which can be saved with 2 to 3 points to save an animal so that each lattice After the data is obtained, the data of the board is coming out. First, you have to get the window that touches, this is relatively simple, you can use: findwindow to implement, the specific code is as follows: CQQGameToolDlg * DLG = (CQQGameToolDlg *) PARM; // This function is made as a thread, So you have to pass a parameter DLG-> hWnd = :: FindWindow (NULL, "QQ pair"); // Query if (DLG-> hwnd == null) DLG-> hWnd = :: FindWindow (null, " Touch "); // It seems that the window title is sometimes different. I don't know if I have a wrong IF (DLG-> hwnd == null) {afxMessageBox (" Did not find the pair of touch windows, please start the right Touch! "); DLG-> setdlgitemtext (IDC_Button1," Start "); DLG-> m_bstart = false; return 0;} to here get QQ to touch the window handle, but to analyze the pixels in the window, You also need to get a window of HDC DLG-> HDC = :: getDC (DLG-> HWnd); the following is the data of the chessboard, first test the coordinates of the upper left corner of the chessboard and the edge length of each lattice, specific test method It is not given, it is relatively simple, the test resulting, the upper left corner coordinate of the checkerboard is (176, 102), and each lattice is 48. Next, the function of saving the checkerboard data is to obtain the parameters of each checkered data, Y is a chessboard coordinate, such as (0, 0) represents the first square in the upper left corner, and the like. We are stored here in the middle of each lattice.

ColorRef * CQQQGameToolDlg :: getRectata (int x, int y) {colorref * color; color = new colorref [48]; int count = 0; for (int i = (x-1) * 48 m_posx; i <(x -1) * 48 m_posx 48; i ) {color [count ] = getpixel (HDC, I, (Y-1) * 48 m_posy 20); // If it is the background color of the board, ignore IF ( Color [count-1] == 0x00EFAA5A || Color [count-1] == 0x00f7c384) color [count-1] = 0x000000;} Return Color;} The following functions get the characteristics of each lattice: here We only take six feature points to store, and save six feature points of hexadecimal. Void CQQGameToolDlg :: getcode () {for (int i = 1; i <= 8; i ) for (int J = 1; j <= 8; j ) {cstring str; colorRef * C; c = getRectdata (i, J); str.format ("% x% x% x% x% x% C", C [25], C [26], C [27], C [28], C [29], C [30 ]); DATA [i] [j] = Str;}} After the above function, the DATA array is saved is the data of the board, here, the acquisition of the board data is over. 2) After analyzing the board data to get the board data, you need to analyze the board data. The idea is to distinguish all the landscapes, and then find two lattices connected to the same animals, then find 6 possible moving plaids around. As long as you find one of the same two in 6 landscons, you will explain the animals in that lattice. For example, as long as any one of the same animals as A, B is found in C, D, E, F, G, and H. The specific code is also relatively simple, that is, the judgment and operation of the array, it will not be given in detail here. 3) Mobile animals From above, we can know where you need to move, now we can identify that the location can be achieved, but for convenience, it is best not to do itself, and use the program to automatically complete the mobile Operation. The implementation is also relatively simple, only need to send a message to the game window, the code is as follows: Since the start is to do automatic movement, the function name or the DrawRect :) x, y is the moving coordinate obtained above. Void Cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqiang Rectangle (HDC, XX, YY, XX 10, YY 10); // This is a picture of a block, comment.

转载请注明原文地址:https://www.9cbs.com/read-53301.html

New Post(0)