Con questo codice accedo ad una pagina web e voglio riempire i campi
utente e password, arrivo quasi alla conclusione ma mi manca un pezzettino
leggi in fondo
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpszOp As String, _
ByVal lpszFile As String, ByVal lpszParams As String, _
ByVal LpszDir As String, ByVal FsShowCmd As Long) _
As Long
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
Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function WindowFromPoint Lib "user32" (ByVal xpoint As Long, ByVal ypoint As Long) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal dwDate As Long, ByVal dwExtraInfo As Long)
Private Const WM_CUT = &H300
Private Const WM_COPY = &H301
Private Const WM_PASTE = &H302
Private Const WM_CLEAR = &H303
Private Const VK_RBUTTON = &H2
Private Const VK_SHIFT = &H10
Private Const VK_INSERT = &H2D
--------------------------------
Private Sub Command1_Click()
Set oApp = CreateObject("internetExplorer.Application")
'oApp.Navigate2 "http://mail.tiscali.it/"
oApp.Navigate2 "http://mail.virgilio.it/login/"
Do
If oApp.readyState = 4 Then
Exit Do
End If
Loop
oApp.Visible = True
End Sub
------------------------------------
Private Sub Command2_Click()
Dim hWnd As Long
'X = 870 'Tiscali
'Y = 333 'Tiscali
X = 805 'Virgilio
Y = 255 'Virgilio
Clipboard.Clear
Clipboard.SetText ("pippo")
SetCursorPos X, Y
hWnd = WindowFromPoint(X, Y)
mouse_event &H2 Or &H4, 0, 0, 0, 0 'vbkeylbutton
'mouse_event &H8 Or &H10, 0, 0, 0, 0 'vbkeyrbutton
End Sub
mi clicca sul text box di Tiscali o di Virgilio e questo va bene
poi nella la fase finale se clicco sulla tastiera Control+V mi copia "pippo"
ed anche con Shift+Insert lo fa ma non va in automatico
provato con 'SendMessage hWnd, WM_PASTE, 0, ByVal 0& non fa niente
provato con 'SendKeys "^V" da errore
provato con 'SendKeys "+{INSERT}" da errore
provato con 'keybd_event VK_SHIFT, 0, VK_INSERT, 0
non fa niente
probabilmente faccio un errore
Ringrazio tanto chi mi aiuta
Enrico