植物打殭屍休閑花園外掛代碼

來源:互聯網
上載者:User

Option Explicit<br />Private Declare Sub mouse_event Lib "User32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)<br />Private Declare Function SetCursorPos Lib "User32" (ByVal x As Long, ByVal y As Long) As Long<br />Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)<br />Const MOUSEEVENTF_MOVE = &H1 ' mouse move<br />Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down<br />Const MOUSEEVENTF_LEFTUP = &H4 ' left button up<br />Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long<br />Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long<br />Private Declare Function ModifyMenu Lib "User32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long<br />Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long<br />Private Const SC_MOVE = &HF010&<br />Private Const MF_BYCOMMAND = &H0&<br />Private Const MF_ENABLED = &H0&<br />Private Const MF_GRAYED = &H1&<br />Private Type rect<br /> Left As Long<br /> Top As Long<br /> Right As Long<br /> Bottom As Long<br />End Type<br />Private Declare Function GetWindowRect Lib "User32" (ByVal hwnd As Long, lpRect As rect) As Long<br />Dim PZG_LEFT&, PZG_TOP&<br />Dim objTimer As New clsWaitableTimer<br />Public isStop As Boolean<br />Private Sub Form_Load()<br /> Me.Move Screen.Width - Me.Width - 90, 90<br /> Text1.Text = vbCrLf & "1.先將遊戲以視窗模式開啟,並開啟到休閑花園" & vbCrLf & _<br /> "2.點擊本程式的""啟動""按鈕開始撿金幣,撿的過程中請不要操作電腦" & vbCrLf & _<br /> "3.如果要停止撿金幣請按快速鍵""CTRL+ALT+C""停止檢金幣" & vbCrLf & _<br /> "4.如果看到需要澆水和施肥請停下程式處理然後再啟動撿金幣" & vbCrLf & vbCrLf & _<br /> " by sysdzw" & vbCrLf & _<br /> " QQ:171977759"<br /> setHotKey Me.hwnd, MOD_ALT + MOD_CONTROL, vbKeyC<br />End Sub<br />Private Sub Form_Unload(Cancel As Integer)<br /> Set objTimer = Nothing<br /> delHotKey Me.hwnd<br /> End<br />End Sub<br />Public Sub Command1_Click()<br /> Dim i&, j&, intMaxLine%</p><p> If Command1.Caption = "啟動" Then<br /> isStop = False<br /> Command1.Caption = "停止"<br /> Else<br /> isStop = True<br /> End If</p><p> objTimer.Wait 500<br /> Do<br /> If Not initLeftTop Then<br /> Check1.Enabled = True<br /> Command1.Caption = "啟動"<br /> Exit Sub<br /> End If</p><p> Check1.Enabled = False<br /> intMaxLine = 11<br /> If Check1.Value Then intMaxLine = intMaxLine + 1<br /> For i = 1 To intMaxLine '點11行,如果帶上蝸牛就再多點一行,變為12行<br /> For j = 1 To 76 '每行點多少列?76<br /> If isStop Then<br /> Check1.Enabled = True<br /> Command1.Caption = "啟動"<br /> Exit Sub<br /> End If<br /> clickPoint PZG_LEFT + j * 10, PZG_TOP + (i - 1) * 30<br /> objTimer.Wait 1<br /> Next<br /> Next<br /> Check1.Enabled = True<br /> objTimer.Wait 5000<br /> Loop<br />End Sub<br />Private Function initLeftTop() As Boolean<br /> Dim hwind&<br /> Dim rect As rect<br /> hwind = FindWindow("MainWindow", "Plants vs. Zombies GOTY ") '擷取表單控制代碼<br /> GetWindowRect hwind, rect<br />' MsgBox rect.Left & "," & rect.Top<br /> If rect.Left <= 0 Then<br /> MsgBox "請將植物大戰殭屍遊戲以視窗模式開啟,並且全部放到螢幕可見範圍內。", vbInformation<br /> Exit Function<br /> End If</p><p> PZG_LEFT = rect.Left + 20<br /> PZG_TOP = rect.Top + 153<br /> initLeftTop = True<br />End Function<br />Private Sub clickPoint(x1 As Long, y1 As Long, Optional ByVal clickTimes As Integer = 1)<br /> SetCursorPos x1, y1<br /> Do While clickTimes > 0<br /> mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0<br /> mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0<br /> clickTimes = clickTimes - 1<br /> Loop<br />End Sub<br />Private Sub Command2_Click()<br /> End<br />End Sub

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.