Das Beispiel dieses Artikels beschreibt das in VB implementierte Betrugsgerät „QQ Beauty Find Difference Game“. Teilen Sie es als Referenz mit allen. Die Einzelheiten lauten wie folgt:
Es ist ziemlich langweilig. Das Prinzip ist sehr einfach. Die Verwendung von VB ist langsamer, aber die Implementierung ist einfach.
Option ExplicitPrivate Type sPOINT x As Long y As LongEnd TypePrivate Declare Function GetDC Lib „user32“ (ByVal hwnd As Long) As LongPrivate Declare Function GetPixel Lib „gdi32“ (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As 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' Platzieren Sie das Fenster oben in der Liste und über jeder Vorderseite des oberen Fensters Private Const SWP_NOSIZE& = &H1' Fenstergröße beibehalten Private Const SWP_NOMOVE& = &H2' Behalten Sie die Fensterposition bei Private Sub Form_Load()SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE' Stellen Sie das Fenster so ein, dass es immer oben ist End Sub' Zerlegen Sie den langen RGB-Wert in 3 Komponenten 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) So lang, p2(497, 447) So lang, C1(3) Als Ganzzahl, C2(3) As Integer 'Die Array-Größe entspricht der Größe des Bildes. Dim pic1 As sPOINT, pic2 As sPOINT 'Legen Sie die Bildschirmposition der beiden Bilder fest. 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) 'Zwei Bilder lesen For i = 0 To 497 Für j = 0 bis 447 p1(i, j) = GetPixel(hD, i + pic1.x, j + pic1.y) p2(i, j) = GetPixel(hD, i + pic2.x, j + pic2 .y) Weiter Weiter 'Kontrast, Differenz markieren Dim t As Boolean t = True For i = 0 To 497 For j = 0 To 447 Call ColorRGB(p1(i, j), C1()) Rufen Sie ColorRGB(p2(i, j), C2()) auf, wenn (Abs(C1(1) - C2(1)) > 30 oder Abs(C1(2) - C2(2)) > 30 Oder Abs(C1(3) - C2(3)) > 30) Dann t = Nicht t Wenn t Dann Picture1.ForeColor = &H0& Else Picture1.ForeColor = &HFF00& End If Else Picture1.ForeColor = p1(i, j) End If Picture1.PSet (i, j) Next NextEnd SubPrivate Sub Picture1_Click()Me.Visible = FalseDoEventsGetPointMe.Visible = TrueEnd Sub
Ich hoffe, dass dieser Artikel für die VB-Programmierung aller hilfreich sein wird.