PDA

Click to See Complete Forum and Search --> : API - Sending Text


LordSyko
May 16th, 2000, 03:46 AM
I've made a Sub that I call within my program (this is for AOL) called SendToChat, so that:

Call SendToChat("Blah blah")

"blah blah" will be sent to chat, now all I want to be able to do right now is get it to the chat text box. Here is my API code:

Public Sub SendToChat(Chat As String)
'Sends a string of text to the chat window
'and sends it
Dim ParHand1 As Long
Dim ParHand2 As Long
Dim OurParent As Long
Dim Hand1 As Long
Dim OurHandle As Long

ParHand1& = FindWindow("AOL Frame25", "America Online")
ParHand2& = FindWindowEx(ParHand1&, 0, "MDIClient", vbNullString)
OurParent& = FindWindowEx(ParHand2&, 0, "AOL Child", vbNullString)
Hand1& = FindWindowEx(OurParent&, 0, "RICHCNTL", vbNullString)
OurHandle& = FindWindowEx(OurParent&, Hand1&, "RICHCNTL", vbNullString)
'finds the chat window text area

Call SendMessageByString(OurHandle&, WM_SETTEXT, 0&, Chat$)
'puts the string to send into the chat window text area

--if you've guessed it hasn't worked you hit the jackpot. i have no idea why, if anyone can help please take a quick look and see if you know why. Its not something stupid like undefined variables etc. everything is declared and defined, but it won't work! help!
-LordSyko (ldsyko@earthlink.net)

May 16th, 2000, 10:37 AM
i am trying to make a program for napster that does the same stuff an AOL proggy does, but only for napster. I am also stuck on how to send text to the text box in napster. all i can do so far is find napsters handle and the textbox in which you type your text handle. i dont know what to do from then on. how do you put text into another programs text box from within yours? i think LordSyko is trying to do this also.

May 16th, 2000, 11:43 AM
This is just a suggestion since I have no clue if that will help, but did you try the SendKeys function.

Osiris
Oct 2nd, 2000, 05:59 PM
This is you code revised

Dim ParHand1 As Long
Dim ParHand2 As Long
Dim OurParent As Long
Dim Hand1 As Long
Dim OurHandle As Long

ParHand1& = FindWindow("AOL Frame25", 0&) '<--- the typo was here
ParHand2& = FindWindowEx(ParHand1&, 0, "MDIClient", 0&)
OurParent& = FindWindowEx(ParHand2&, 0, "AOL Child", 0&)
Hand1& = FindWindowEx(OurParent&, 0&, "RICHCNTL", 0&)
OurHandle& = FindWindowEx(OurParent&, Hand1&, "RICHCNTL", 0&)
'finds the chat window text area
Print ParHand1&
Print ParHand2&
Print OurParent&
Print Hand1&

Call SendMessageByString(OurHandle&, WM_SETTEXT, 0&, "HELLO")
'puts the string to send into the chat window text area

LordSyko
Oct 2nd, 2000, 06:09 PM
thanks,
i got it working a long time ago but i still appreciate the help ;-D
-nate