本文實例講述了VB實現的《QQ美女找茬遊戲》作弊器。分享給大家供大家參考。具體如下:
比較無聊哈,原理很簡單,用VB速度比較慢,但實作很容易。
Option ExplicitPrivate Type sPOINT x As Long y As LongEnd TypePrivate Declare Function GetDC Lib "user32" (ByValnd As Long) As LongPrivate Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByValValer, ByValerli LongPrivate 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 LongPrivate Const HWND_TOPMOST& = -1' 將視窗置入於清單頂部,並位於任何最頂部視窗的前面Private Const SWP_NOSIZE& = &H1'保持視窗位置Private Const SWP_NOMOVE& = &H2' 保持視窗位置Private Sub Form_Load()SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE' 將視窗設為總在最前面的 Sub' RGB值分解成3個分量Sub ColorRGB(Color As Long, C() As Integer) Const ByN As Integer = 256 Const ByN2 As Long = 65536 C(1) = (Color Mod ByN) C(2) = ((Color Mod ByN2) / ByN) C(3) = (Color / ByN2)End SubPrivate Sub GetPoint() Dim p1(497, 447) As Long, p2(497, 447) As Long, C1(3) As Integer, C2(3) As Integer '陣列大小符合圖片的大小Dim pic1 As sPOINT, pic2 As sPOINT '設定兩張圖片的螢幕位置pic1.x = 8 pic1.y = 192 pic2 .x = 517 pic2.y = 192 Dim h As Long, hD As Long, r As Long, i As Integer, j As Integer hD = GetDC(0) '讀入兩張圖片For i = 0 To 497 For j = 0 To 447 p1(i, j) = GetPixel(hD, i + pic1.x, j + pic1.y) p2( i, j) = GetPixel(hD, i + pic2.x, j + pic2.y) Next Next '對比,標記差異Dim t As Boolean t = True For i = 0 To 497 For j = 0 To 447 Call ColorRGB(p1(i, j), C1()) Call ColorRGB(p2(i, j), C2()) If (Abs(C1(1) - C2 (1)) > 30 Or Abs(C1(2) - C2(2)) > 30 Or Abs(C1(3) - C2(3)) > 30) Then t = Not t If t Then Picture1.ForeColor = &H0& Else Picture1.ForeColor = &HFF00& End If Else Picture1.ForeColor = p1(i, j) End If Picture1.PSet (i, j) Next Next Picture Subiv. )Me.Visible = FalseDoEventsGetPointMe.Visible = TrueEnd Sub
希望本文所述對大家的VB程式設計有幫助。