Fazi that works great.
Can you help me make a function for this program? its a lot easier. I can already submit the button "Check email"
Here is a screenshot:
http://img370.imageshack.us/img370/4572/lastph2.jpg
you have to access the group container that it is in.
This is the code im using to press the "check email" button:
Private Declare
The functionCode:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long Private Const BM_CLICK As Long = &HF5& Private Const WM_SETTEXT = &HC Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
and the module:Code:Private Sub SendSubmit() On Error Resume Next Dim WinWnd As Long Dim Ret As Long Dim ErrNum As Integer 'Find window Handle WinWnd = FindWindow(vbNullString, "email poster") If WinWnd <> 0 Then 'Show the form 'AppActivate "email poster" 'Find button handle by going through every child control in the form EnumChildWindows WinWnd, AddressOf EnumChildProc, ByVal 0& If BtnHwnd <> 0 Then 'Send the Message Ret = SendMessage(BtnHwnd, BM_CLICK, 0, 0&) Else ErrNum = 2 'Button was not found End If Else ErrNum = 1 'Window was not found End If 'Errors Select Case ErrNum Case 1 Me.Caption = "Window handle could not be found" Case 2 Me.Caption = "Button was not found on form" End Select End Sub
Code:Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Public BtnHwnd As Long Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long Dim sSave As String 'Get the windowtext length sSave = Space$(GetWindowTextLength(hwnd) + 1) 'get the window text GetWindowText hwnd, sSave, Len(sSave) 'remove the last Chr$(0) sSave = Left$(sSave, Len(sSave) - 1) If sSave = "Check email" Then BtnHwnd = hwnd Exit Function End If 'continue enumeration EnumChildProc = 1 End Function
Right now it just hits the "check email" button. can you make it send the email/popserver/password text that is located on another form/program?![]()




Reply With Quote