How can I get Text from a textbox? I've got the handle (I know, it changes every time you start a program).
if I use GetWindowText, I don't get the text that the user typed in the textbox.
Hope you can help,
VisualPenguin
Printable View
How can I get Text from a textbox? I've got the handle (I know, it changes every time you start a program).
if I use GetWindowText, I don't get the text that the user typed in the textbox.
Hope you can help,
VisualPenguin
Sure.
VB Code:
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 SendMessageStr Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As String) As Long Private Const WM_GETTEXT = &HD Private Const WM_GETTEXTLENGTH = &HE Private Sub Command1_Click() Dim lngLen As Long Dim strBuffer As String lngLen = SendMessage(YourHandle, WM_GETTEXTLENGTH, 0, 0) strBuffer = Space(lngLen) Call SendMessageStr(YourHandle, WM_GETTEXT, lngLen, ByVal strBuffer) MsgBox strBuffer End Sub
thanks
VIsualPenguin