Results 1 to 4 of 4

Thread: SendDlgItemMessage

  1. #1

    Thread Starter
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Well, if it's in your program can't you just use the normal VB syntax?
    VB Code:
    1. MsgBox txtMyTextBox.Text
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  2. #2
    Junior Member
    Join Date
    Apr 2001
    Posts
    22
    It is not in my program. What I want to do is check the message box of another program and click on its button. I have the code to do the check for the program and the click. I just need to be able to check the message now.

  3. #3
    Lively Member
    Join Date
    Dec 2000
    Location
    Indiana
    Posts
    73
    Here ya go.
    PHP Code:
    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongByVal wMsg As LongByVal wParam As LonglParam As Any) As Long

    public function gettext(hwnd as long) as string
       Dim sz 
    as integer
       sz
    =SendMessage(hwnd,WM_GETTEXTLENGTH,0,0)
       
    sz=sz+1
       call SendMessage
    (hwnd,WM_GETTEXT,sz,gettext)
    end function

    public 
    sub settext(hwnd as longtext as string)
       
    SendMessage(hwnd,WM_SETTEXT,0,text)
    end sub

    'To set a string, do this:
    call settext(Text1.hwnd,"This is the new text")
    '
    To get a string, do this:
    text gettext(Text1.hwnd)
    'There ya have it!  Of course, you COULD do this:
    Text1.text = "This is the new text"
    '
    and
    text=Text1.text
    'But, the API version is much more fun, doncha think? 
    if(GetWindowLong(hwnd,GWL_ID)==IDC_MICROSOFT_APPLICATION)
    {
    SetWindowText(hwnd,"I suck.");
    SendMessage(hwnd,WM_START_SUCKING,0,0);
    SendMessage(hwnd,WM_CRASH,0,0);
    }

  4. #4
    Junior Member
    Join Date
    Apr 2001
    Posts
    22
    Thanks I will try this

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