|
-
Nov 16th, 2001, 12:17 PM
#1
Thread Starter
Fanatic Member
Code:
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const ES_PASSWORD = &H20&
Private Const WM_SETTEXT As Long = &HC
Private Const BM_CLICK = &HF5
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 Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessageString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
(ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) 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 ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Const SW_SHOWNORMAL = 1
Private Sub Form_Load()
Dim hTxtWnd&
Dim lWndStyle&
Dim bFound As Boolean
Dim lngSIapp As Long, RetVal As Long, lpClassName As String
lngSIapp = FindWindow(vbNullString, "Connect to APS")
hTxtWnd = FindWindowEx(lngSIapp, 0&, "Edit", vbNullString)
Do While Not bFound
hTxtWnd = FindWindowEx(lngSIapp, hTxtWnd, "Edit", vbNullString)
lWndStyle = GetWindowLong(hTxtWnd, GWL_STYLE)
If lWndStyle And ES_PASSWORD Then
MsgBox "found password WIndow"
SendMessageString hTxtWnd, WM_SETTEXT, 0, "password"
bFound = True
lngSIapp = FindWindowEx(lngSIapp, 0&, "Button", "OK")
SendMessage lngSIapp, BM_CLICK, 0, 0
Exit Do
End If
Loop
End Sub
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Nov 19th, 2001, 03:54 AM
#2
you've done this before 
Cheers - I was tearing my hear ouit at that one, I really should learn this API stuff properly
-
Nov 19th, 2001, 04:43 AM
#3
Thread Starter
Fanatic Member
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Nov 19th, 2001, 08:46 PM
#4
get the hwnd of the edit control and send WM_SETTEXT to set the password. you could make it also login automatically, find the button hwnd and send WM_LBUTTONDOWN or whatever
-
Nov 20th, 2001, 03:14 AM
#5
Conquistador
He's already solved it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|