Visualizzazione dei risultati da 1 a 3 su 3

Discussione: [VB.NET] Incolla

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2010
    Messaggi
    143

    [VB.NET] Incolla

    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

  2. #2
    Utente di HTML.it
    Registrato dal
    Jan 2010
    Messaggi
    143
    Risolto
    Il programma funziona così
    1) apre la mail e attiva Timer1
    2) Si aspetta fino a quando la mail non si è stabilizzata
    con il colore blu della barra dove c'è scritto "accedi con facebook"
    3) Si avvia Timer2 e dopo 2 secondi si va su Dati1() che mette
    il nome utente con il codice
    Clipboard.Clear()
    Clipboard.SetText("utente")
    Application.DoEvents()
    SendKeys.Send("+{INS}") 'Shift + INS (incolla)
    4) Si aspettano altri 2 secondi e si fa partire Dati3()
    per la password con il codice
    Clipboard.Clear()
    Clipboard.SetText("password")
    Application.DoEvents()
    SendKeys.Send("+{INS}") 'Shift + INS (incolla)

    e così funziona anche con windws-10 ed explorer-11

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2010
    Messaggi
    143
    codice:
    Imports System.Threading
    
    Public Class Form1
        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
        Private Declare Function GetPixel Lib "gdi32.dll" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer
        Private Declare Function GetWindowDC Lib "user32.dll" (ByVal hwnd As Integer) As Integer
        Private Declare Auto Function SendMessage Lib "user32" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
        Private Declare Function GetForegroundWindow Lib "user32" () As Long
    
        Const tt = 300
        Dim hwnd As Double
        Dim cc As Double
        Dim ax1, ay1, az, jk, hk As Integer
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.TopMost = True
        End Sub
    
        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 Dati1()
            ax1 = 1050    'posizione X del textbox del nome utente
            ay1 = 370     'posizione Y del textbox del nome utente
            SetCursorPos(ax1, ay1)
            
            Singolo()     'simula click del mouse
            Clipboard.Clear()
            Clipboard.SetText("utente")
            Application.DoEvents()
            SendKeys.Send("+{INS}") 'Shift + INS (incolla)
            
        End Sub
    
        Private Sub Dati3()
            ax1 = 1050   'posizione X del textbox della password
            ay1 = 445    'posizione Y del textbox della password
            SetCursorPos(ax1, ay1)
            
            Singolo()
            Clipboard.Clear()
            Clipboard.SetText("password")
            Application.DoEvents()
            SendKeys.Send("+{INS}") 'Shift + INS (incolla)
    
        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(tt)
            mouse_event(meFlags.MOUSEEVENTF_LEFTUP Or meFlags.MOUSEEVENTF_ABSOLUTE, tpnt, 0, New UIntPtr(Convert.ToUInt32(0)))
    
        End Sub
    
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            ax1 = 1050   'posizione X della barra blu "accedi con facebook"
            ay1 = 290    'posizione Y della barra blu "accedi con facebook"
            'Per determinare posizione e colore uso prima il prg "Colore pixel" in vb6
            Dim hdc = GetWindowDC(0)
            
            cc = GetPixel(hdc, ax1, ay1)
            
            If cc = 10310967 Then
                Timer1.Enabled = False
                Timer2.Enabled = True
            End If
        End Sub
    
        Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
            hk = hk + 1
            If hk = 2 Then
                Dati1()
            End If
    
            If hk = 4 Then
                Dati3()
                hk = 0
                Timer2.Enabled = False
            End If
     
        End Sub
    
    End Class
    e così funziona anche con windws-10 ed explorer-11
    Ultima modifica di MItaly; 25-05-2016 a 01:15

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.