Salve a Tutti
perchè questo codice in vb.net funziona con win7 e explorer9
ma funziona male con win10 ed explore11?
Non scrive nei due textbox esterni le parole "utente"
e "password" oppure una si e una no, poi a volte scrive
giusto.
codice:Imports System.Diagnostics Imports System.ComponentModel Imports System.Text Imports System.Threading Enum meFlags As Integer MOUSEEVENTF_MOVE = &H1 MOUSEEVENTF_LEFTDOWN = &H2 MOUSEEVENTF_LEFTUP = &H4 MOUSEEVENTF_RIGHTDOWN = &H8 MOUSEEVENTF_RIGHTUP = &H10 MOUSEEVENTF_MIDDLEDOWN = &H20 MOUSEEVENTF_MIDDLEUP = &H40 MOUSEEVENTF_XDOWN = &H80 MOUSEEVENTF_XUP = &H100 MOUSEEVENTF_WHEEL = &H800 MOUSEEVENTF_VIRTUALDESK = &H4000 MOUSEEVENTF_ABSOLUTE = &H8000 End Enum Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As meFlags, ByVal Coords As Drawing.Point, ByVal dwData As Integer, ByVal dwExtraInfo As UIntPtr) Private Declare Auto Function SetCursorPos Lib "user32.dll" (ByVal x As Integer, ByVal y As Integer) As Integer 'Dim LocalMousePosition As Point Public Declare Function GetPixel Lib "gdi32.dll" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer Public Declare Function GetWindowDC Lib "user32.dll" (ByVal hwnd As Integer) As Integer Const tt = 300 Dim ax1, ay1, az, jk As Integer Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Process.Start("http://mail.tiscali.it/") Timer1.Enabled = True End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick ax1 = 1050 ay1 = 290 Dim hdc = GetWindowDC(0) TextBox1.Text = GetPixel(hdc, ax1, ay1) If TextBox1.Text = 10310967 Then Dati1() Timer1.Enabled = False End If End Sub Private Sub Dati1() ax1 = 1050 ay1 = 370 SetCursorPos(ax1, ay1) Singolo() Clipboard.Clear() Clipboard.SetText("utente") SendKeys.Send("+{INS}") ' Shift + INS (incolla) Dati3() End Sub Private Sub Dati3() ax1 = 1050 ay1 = 445 SetCursorPos(ax1, ay1) Threading.Thread.Sleep(500) Singolo() Threading.Thread.Sleep(500) Clipboard.Clear() Clipboard.SetText("password") SendKeys.Send("+{INS}") End Sub Private Sub Singolo() 'Click singolo Dim tpnt As New Drawing.Point(0, 0) mouse_event(meFlags.MOUSEEVENTF_LEFTDOWN Or meFlags.MOUSEEVENTF_ABSOLUTE, tpnt, 0, New UIntPtr(Convert.ToUInt32(0))) Threading.Thread.Sleep(300) mouse_event(meFlags.MOUSEEVENTF_LEFTUP Or meFlags.MOUSEEVENTF_ABSOLUTE, tpnt, 0, New UIntPtr(Convert.ToUInt32(0))) End Sub

Rispondi quotando