Results 1 to 17 of 17

Thread: Sending messages from VB App To ChatRoom

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    8

    Sending messages from VB App To ChatRoom

    Anyone tried to send a message from VB application to the chat room of paltalk messenger application. If so, please help me, suppose that I've already knew the chat room window title. Thanks


    I tried moeur code, but no luck.
    Last edited by Hack; Jul 8th, 2005 at 12:59 PM.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Sending messages between VB-created apps

    Welcome to the forums vuongthacsi

    If it is a text box you want to send the message to, You could send a WM_SETTEXT message, provided you know the class name of the text box you are after. If you have Spy++ you can use the Window Finder tool to get the class name, if you don't then you can grab Joacim Andersson's clone from the Codebank section

  3. #3
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Sending messages between VB-created apps

    You could also try to use the SendKeys function

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Sending messages between VB-created apps

    Split from an old thread into its own.

  5. #5
    Addicted Member
    Join Date
    Aug 2002
    Location
    Michigan
    Posts
    181

    Re: Sending messages from VB App To ChatRoom

    Download and install ApiSpy. Run it. Mark the target window as directed and generate code. Copy and paste the code into your project. Test, debug, edit...test...

    In my case, the automatically generated code started too far down the tree. If you get null results from the api calls, that is your clue. You must use the set text fn!! Your code needs to cover versions 7 & 8 of PT, there are changes to the window structure of the user interface.

  6. #6
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Sending messages from VB App To ChatRoom

    Ben,

    At first I thought you were responding to a different question, then I thought maybe not.

    APISPY will tell you what API calls a program makes, but nothing else (unless there is a new version out there I didn't know about.)

    Did you attempt to spy on paltalk?

    What do you mean that it started too far down the tree? Apispy launches the program and starts logging API calls right away.

    I'm just curious.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    8

    Re: Sending messages from VB App To ChatRoom

    Thank you for all responses, Please have a look at my code, it changes the title of the status bar of paltalk chat room, it is not sending a msg to chat room. Please indicate any error that i made. thanks again.

    Private Sub cmdSendStyle_Click()
    Dim sTextToSend As String
    Dim sRoom As String
    Dim sClassName As STring
    Dim hWndForm As Long
    Dim hWndTextBox As Long

    sTextToSend = "Hello all" ' Text to send
    sClassName = "My Window Class" ' Class Name of paltalk chatroom window
    sRoom = "Music - Voice Group" ' Voice chat room title on the top bar

    hWndForm = FindWindow(sClassName, sRoom)
    hWndTextBox = FindWindowEx(hWndForm, 0&, vbNullString, vbNullString)

    SendMessage hWndTextBox, WM_SETTEXT, 0&, sTextToSend$
    End Sub

  8. #8
    Addicted Member
    Join Date
    Aug 2002
    Location
    Michigan
    Posts
    181

    Re: Sending messages from VB App To ChatRoom

    ApiSpy shows the name & handle of the current window. It has multiple functions. One of them generates code for finding window handles. You drag a yellow life ring to the target window and it generates code for finding each of the windows in the tree.

    In my case, it should have started with the top most window in the PT room, but instead, started further down, so that it could not find any windows, always returning a null result. I had to work up to the top of the tree, coding the search at each level.

  9. #9
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Sending messages from VB App To ChatRoom

    it changes the title of the status bar of paltalk chat room, it is not sending a msg to chat room.
    This is because the window class you are trying to access is a custom class that doesn't act like a text box.

    There was a similar thread earlier by Remix where he was trying to do the same thing to his Trillian program. Here is the link to that thread.
    http://www.vbforums.com/showthread.php?t=345700

    Or you can PM him to see if he got antwhere

  10. #10

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    8

    Re: Sending messages from VB App To ChatRoom

    Thanks all, I've got it worked, it sends text to the textbox of paltalk chatroom, now I again have another problem, how can I send that text to the chat room without hit the Enter key on the keyboard

  11. #11
    Addicted Member
    Join Date
    Aug 2002
    Location
    Michigan
    Posts
    181

    Re: Sending messages from VB App To ChatRoom

    I do not remember if I used send keys or a special command with the api call. one or the other. But I lose all rtf formating set in the richtextbox.

  12. #12

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    8

    Re: Sending messages from VB App To ChatRoom

    Yes, I use sendkeys, and now it worked perfect

    Thanks all guys

  13. #13
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Sending messages from VB App To ChatRoom

    how can I send that text to the chat room without hit the Enter key on the keyboard
    I don't understand, can you show me the code?

  14. #14
    Addicted Member
    Join Date
    Aug 2002
    Location
    Michigan
    Posts
    181

    Re: Sending messages from VB App To ChatRoom

    Quote Originally Posted by moeur
    I don't understand, can you show me the code?
    VB Code:
    1. Call SendMessageLong(richedita, WM_KEYDOWN, 13, 0&)

  15. #15
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Sending messages from VB App To ChatRoom

    This is not clear what you are trying to do.

    Do you want to click on a button?

    Then you can sendkeys "{ENTER}"

  16. #16

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    8

    Re: Sending messages from VB App To ChatRoom

    Quote Originally Posted by moeur
    I don't understand, can you show me the code?
    After sending the text to the textbox of the paltalk chatroom, we need another step to send that text to the paltalk chatroom screen, to do that I use:
    SendKeys "{ENTER}" ' Using enter key to send the text
    SendKeys "" ' to stop the enter key, otherwise it will flood the room.

  17. #17

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    8

    Re: Sending messages from VB App To ChatRoom

    Quote Originally Posted by Ben Powell
    VB Code:
    1. Call SendMessageLong(richedita, WM_KEYDOWN, 13, 0&)
    Thanks Ben,
    After finding the class name of the paltalk chatroom textbox, I used your code, it worked perfect too.

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