Home > Software engineering >  QQ chess I everyday, chess wizard
QQ chess I everyday, chess wizard

Time:11-14

Using man-machine against chess wizard, automatic brush QQ chess points every day
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function timeGetTime Lib "winmm. DLL () As" Long
Private Declare Function ClientToScreen Lib "user32" (ByVal HWND, As Long As lpPoint POINTAPI) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal HWND As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long As Long)
Private Const BI_RGB=0 & amp;
Private Const DIB_RGB_COLORS=0
Private Const OBJ_BITMAP As Long=7
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type the RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Type BITMAPINFOHEADER
BiSize As Long
BiWidth As Long
BiHeight As Long
BiPlanes As Integer
BiBitCount As Integer
BiCompression As Long
BiSizeImage As Long
BiXPelsPerMeter As Long
BiYPelsPerMeter As Long
BiClrUsed As Long
BiClrImportant As Long
End Type
Private Type RGBQUAD
RgbBlue As Byte
RgbGreen As Byte
RgbRed As Byte
RgbReserved As Byte
'Gray=R * 0.59 * 0.3 + G + B * 0.11
End Type
Private Type BITMAPINFO
BmiHeader As BITMAPINFOHEADER
BmiColors As RGBQUAD
End Type
Private Declare Function GetDesktopWindow Lib "user32 () As" Long
Private bi24BitInfo As BITMAPINFO
Private aBytes () As Byte
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpclassname As String, ByVal lpWindowName As String) As Long

Private Declare Function GetCurrentObject Lib "gdi32. DLL" _
(ByVal HDC As Long, ByVal uObjectType As Long) As Long

Private Declare Function GetDIBits Lib "gdi32" _
(ByVal aHDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long
Private Declare Function GetClientRect Lib "user32" (ByVal HWND As Long, lpRect As the RECT) form As Long 'take size position
Private Declare Function GetWindowRect Lib "user32. DLL" _
(ByVal HWND As Long, ByRef lpRect As the RECT) As Long

Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function PrintWindow Lib "user32" (ByVal HWND As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long

Private Declare Function SelectObject Lib "gdi32" _
(ByVal HDC As Long, ByVal hObject As Long) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal HDC As Long, ByVal nXEnd As Long, ByVal nYEnd As Long) draw a line As Long 'statement
Private Declare Function GetDC Lib "user32" (ByVal HWND) As Long As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal HDC) As Long As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal HWND As Long, ByVal HDC) As Long As Long 'release DC reference screen

Private Declare Function DeleteDC Lib "gdi32" (ByVal HDC) As Long As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" _
(ByVal HDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any Source, As Any, ByVal Length As Long)
Private Declare Function GetPixel Lib "gdi32" (ByVal HDC As Long, ByVal x As Long, ByVal y As Long) As Long 'color statement
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam) As Long As Long 'statement message PostMessage
Private Const WM_LBUTTONDOWN=& amp; H201 'by pressing the left mouse button
Private Const WM_LBUTTONUP=& amp; H202 'release the left mouse button
Private Const WM_KEYDOWN=& amp; H100
Private Const WM_KEYUP=& amp; H101


'* * * * * * * * * * * * * * * the above is the API declaration section and BMP file header definition * * * * * * * * * * * * * * * * * * *
Public Function getcolour (ByVal HWND As the Variant, colour_bgr As the Variant, xz As Long, yz As Long, XQC As Long, yqc As Long, XZC As Long, yzc) As Long As Long '1 to capture screenshots background parameters, window handle, parameter 2 to save the file path

'Public Function getcolour (ByVal hWnd As the Variant, aBytes As the Variant, xz As Long, yz As Long, XQC As Long, yqc As Long, XZC As Long, yzc) As Long As Long' background screenshots, parameters to capture window handle, 2 want to save the file path
Dim hWndTarget As Long
Dim rc As the RECT
Dim rc1 As the RECT
Dim iBitmap As Long
Dim the mDC As Long, nDC As Long
Dim mBmp As Long
Dim oldBmp As Long
Dim W As Long, h As Long, Bmplen As Long, R, As Long As Long I, ii As Long
Dim BMPbyte (53) As Byte
HWndTarget=HWND
If hWndTarget=0 Then
Getcolour=0
The Exit Function
End the If
GetWindowRect hWndTarget, rc 'get a handle to the window rectangle location, size,
If (rc) Right - rc) Left) Mod 4 & gt; 0 Then
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VBA
  • Related