tree1 = GetPixel(GetDC(0), tree1x, tree1y)
Dim minus As Integer = tree1 - 300000
Dim plus As Integer = tree1 + 300000
If minus < tree1b And plus > tree1b Then
SetCursorPos(tree1x, tree1y)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Else
Dim dc As IntPtr = GetDC(0)
tree2 = GetPixel(dc, tree2x, tree2y)
Dim minus1 As Integer = tree2 - 300000
Dim plus1 As Integer = tree2 + 300000
If minus1 < tree2b And plus1 > tree2b Then
SetCursorPos(tree2x, tree2y)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End If
ReleaseDC(0,dc)
End If
A k deklarácii GetDC pridajte aj ReleaseDC:
<System.Runtime.InteropServices.DllImport("user32.dll")> _
Public Function GetDCint ReleaseDC(hWnd As IntPtr, HDC As IntPtr)
End Function
|