|
-
Nov 4th, 2000, 06:15 AM
#1
Thread Starter
New Member
im wondering how to get the value of a text box of another program????
-
Nov 4th, 2000, 08:12 AM
#2
Junior Member
hi
download this source code
http://www.geocities.com/HUS_ME
bYe
-
Nov 4th, 2000, 08:15 AM
#3
transcendental analytic
This should get the text of the calculators result window:
Code:
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 GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) 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 Sub Form_Load()
Dim hcalcwnd As Long, hResultwnd As Long
hcalcwnd = FindWindow("SciCalc", vbNullString)
hResultwnd = FindWindowEx(hcalcwnd, 0&, "Static", vbNullString)
Debug.Print GetWndText(hResultwnd)
End Sub
Private Function GetWndText(hwnd As Long)
Dim l As Long, temp As String
l = GetWindowTextLength(hwnd)
temp = Space(l)
GetWindowText hwnd, temp, l
l = InStr(temp, vbNullChar) - 1
If l Then
GetWndText = Left(temp, l)
Else
GetWndText = temp
End If
End Function
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 4th, 2000, 08:34 AM
#4
There are some declarations and code that you can erase to make it shorter.
Code:
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 GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Sub Form_Load()
Dim hResult
hResult = FindWindowEx(FindWindowEx(0, 0, "SciCalc", vbNullString), 0&, "Static", vbNullString)
Debug.Print GetWndText(hResult)
End Sub
Private Function GetWndText(ByVal hwnd As Long)
Dim temp As String * 255
GetWindowText hwnd, temp, 255
GetWndText = Left(temp, Len(temp) - InStr(1, temp, vbNullChar))
End Function
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
|