Results 1 to 3 of 3

Thread: get text from textbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115

    get text from textbox

    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
    ICQ :137108715
    MSN Messenger : [email protected]

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Sure.
    VB Code:
    1. 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
    2. 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
    3. Private Const WM_GETTEXT = &HD
    4. Private Const WM_GETTEXTLENGTH = &HE
    5.  
    6.  
    7.  
    8. Private Sub Command1_Click()
    9.     Dim lngLen As Long
    10.     Dim strBuffer As String
    11.    
    12.     lngLen = SendMessage(YourHandle, WM_GETTEXTLENGTH, 0, 0)
    13.     strBuffer = Space(lngLen)
    14.     Call SendMessageStr(YourHandle, WM_GETTEXT, lngLen, ByVal strBuffer)
    15.     MsgBox strBuffer
    16. End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    thanks

    VIsualPenguin
    ICQ :137108715
    MSN Messenger : [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width