Results 1 to 10 of 10

Thread: help!

  1. #1

    Thread Starter
    Lively Member Blaster's Avatar
    Join Date
    Jun 2001
    Posts
    70

    Arrow help!

    I'm using this code
    I want it to send Hello to text1.text

    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 Sub Command1_Click()
    Dim sText As String
    sText = "Hello"
    SendMessage Text1.hwnd, WM_SETTEXT, 0, ByVal sText
    End Sub

    its not working

  2. #2
    Megatron
    Guest
    You need to define WM_SETTEXT.
    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 Const WM_SETTEXT = &HC
    3.  
    4. Private Sub Command1_Click()
    5.     Dim sText As String
    6.     sText = "Hello"
    7.     SendMessage Text1.hwnd, WM_SETTEXT, 0, ByVal sText
    8. End Sub

  3. #3

    Thread Starter
    Lively Member Blaster's Avatar
    Join Date
    Jun 2001
    Posts
    70
    Thanks, now how would I beable to put "hello" in an ICQ message?

  4. #4

    Thread Starter
    Lively Member Blaster's Avatar
    Join Date
    Jun 2001
    Posts
    70
    ok i got this so far
    VB Code:
    1. 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
    2. Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
    3. Private Declare Function SendMessageByStr& Lib "user32" Alias "SendMessageA" _
    4.  (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal _
    5.   lParam As String)
    6.  
    7. Private Const WM_SETTEXT = &HC
    8.  
    9. Private Sub Command1_Click()
    10. Dim x&
    11. Dim richedit&
    12. x& = FindWindow("#32770", vbNullString)
    13. richedit& = FindWindowEx(x&, 0&, "richedit", vbNullChar)
    14. SendMessageByStr richedit, WM_GETTEXT, 0, "hello"
    15. End Sub

    why won't it work?

  5. #5
    New Member Eeyore82's Avatar
    Join Date
    Apr 2001
    Location
    Gloucester, UK
    Posts
    13
    Ummmm....... I dont know if you meant to do this, or even if it is the only error in your code, but you used WM_GETTEXT instead of WM_SETTEXT.

    If you did want to use WM_GETTEXT, you would have to declare that in the same way.

  6. #6

    Thread Starter
    Lively Member Blaster's Avatar
    Join Date
    Jun 2001
    Posts
    70
    oh whoops typo

  7. #7

    Thread Starter
    Lively Member Blaster's Avatar
    Join Date
    Jun 2001
    Posts
    70
    oh it works man I am dumb!!

  8. #8
    Addicted Member FOOBAR's Avatar
    Join Date
    Aug 2000
    Posts
    172
    just to let you know, #32770 is used for many differ windows...because #32770 is dialog and it might send it to 1 or more window, you might wanna try using the findwindow functino and use the caption of icq message box
    No Comment.

  9. #9
    Addicted Member FOOBAR's Avatar
    Join Date
    Aug 2000
    Posts
    172
    here this will send it to iccq message box, if u have the message window open

    VB Code:
    1. 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
    2. Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
    3. Private Declare Function SendMessageByStr& Lib "user32" Alias "SendMessageA" _
    4.  (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal _
    5.   lParam As String)
    6.  
    7. Private Const WM_SETTEXT = &HC
    8.  
    9. Private Sub Command1_Click()
    10. Dim x&
    11. Dim richedit&
    12. x& = FindWindow(vbNullString, "Send Online Message")
    13. richedit& = FindWindowEx(x&, 0&, "richedit", vbNullChar)
    14. SendMessageByStr richedit, WM_SETTEXT, 0, "hello"
    15. End Sub
    also if u use chat message mode, u would have to do somthing like this

    x& = FindWindow(vbNullString, "FUBAR (Online) - Message Session")

    which would be the title of the message window if u were sending to me
    No Comment.

  10. #10

    Thread Starter
    Lively Member Blaster's Avatar
    Join Date
    Jun 2001
    Posts
    70
    thanks

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