  iVe   API Programming Help #5 (Text) by: JeR

                                   TexT

--Getting Text From The Chat Room

One of the most popular ways to get the text from a chat room, is
subclassing, to get the text from a chat room, and effectively make an
external AOL chat room, that has the right spacing between names, you will
need to reset the tabstops on your text box.  Before you subclass the chat
room and get the text, you will need to reset the tabstops for the text box
in which you would like to display the text.  To do this you will use an API
function called EM_SetTabStops.  This will be used to change the default
tabstops on a multiline edit control.  To use this function, you will have to
make a subroutine similar to this example.


Sub SetTabStops()
     ReDim TabPlace(4)

TabPlace(0) = 32
TabPlace(1) = 64
TabPlace(2) = 96
TabPlace(3) = 118

SetTab = SendMessage(Text1.hWnd, EM_SetTabStops, 4, TabPlace(0))
Text1.Refresh


This will set the Tabs at ever 32 Dialog Base Units, which are about 1/4 of
the average character length.  For The wParam you pass the number of tab
stops you would like to set.  You must make an array with tabstops for at
least this many tabstops.  The lParam is the first address of an integer
array, which is the tabstop placement.


--Getting Text From MultiLine Edit Controlls

To get text from a multi line edit control with more than one line you cannot
use WM_GETTEXT (without a GPF anywayz) so there is message called EM_GETLINE.
This can be hard to do because you must give for the lParam an address to a
string buffer with the first 2 bytes of this address as an integer that is
the maximum number of characters it can be loaded into the buffer.  To do
this, we would use something like the code below.

Dim a, b as Integer, Buffer1$
    a = SendMessageBynum(text1.hWnd, EM_LINEINDEX, 0, 0&)
    b = SendMessageBynum(text1.hWnd, EM_LINELENGTH, 0, 0&) + 1
    Buffer1$ = String$(b + 2, 0)
    Mid$(Buffer1$, 1, 1) = Chr$(b And &HFF)
    Mid$(Buffer1$, 2, 1) = Chr$(b \ &H100)
    b = SendMessageByString(text1.hWnd, EM_GETLINE, 0, Buffer1$)
    Buffer1$ = Left$(Buffer1$, b)

This will return the first line of your multi line edit control.
