INTRO
=====
Ok these files will be pretty disorganized for now so bear with me here. The
purpose of these text files is to teach people who can already program in
Visual Basic how API works. If you can't make a simple program in Visual
Basic, learn that before you try to take on API. I will not teach you how to
make a bot or anything in these files so if thats all your interested in,
stop reading now. Understanding how API works is the key to being able to
make programs using API. Its not about code, its about logic. If you
understand how something API works, you can tackle any problem that comes in
your way with nothing more than a few constant values and some declarations,
both of which are in help files that come with Visual Basic. So, on with the
lesson.






First, Handles and Child Items...

Handles - Everything in Windows has a handle, a number that identifies it,
sort of like an ID number. By using these handles, you can tell windows to
move, read info on windows, click on buttons, and so on. However, the handle
of an item changes everytime it is loaded, so the handle of your List Rooms
button, for example, won't be the same as the last time that you loaded up
Peoples Connection. The first step in any API call is finding the handle of
the item you are trying to use.

Child Items - Every item that is a part of a larger item is known as a child.
The List Rooms button is a child of the chat window. The chat window is a
child of AOL (not directly but we'll get into that later). To locate child
items, you have to tell Windows to look at the parent of that item in order
to locate it. What ends up happening is that you have to take a whole item,
the AOL program itself, and find things under AOL, then look in what you
found for something else and so on until you focus on what you're looking
for. Favorite Places is a good example...

AOL --> MDIClient --> Favorite Places

This is the order in which you would locate the handle of the Favorite Places
window. 

You might be asking, whats this MDIClient all about? Well, AOL is whats known
as an MDI program. There is one large window (the one titled "America
Online") and windows within that. Most programs aren't MDI programs, like
Write for example is just one window with everything in it. Thats why you can
have a chat window, an IM box, and so on, all open in AOL, but you can't have
more than one document open in Write.

If your lost at this point (sorry I'm not a great writer) try going back and
reading over some parts. If you still can't understand, ask some people about
it or try and find me and ask me. If you understand so far, go on.

Class Names - Most items have class names, describing what they are. For
example, the class name of the toolbar in AOL is "AOL Toolbar", and the class
name of the screen where you see the chat in a chat room is "_AOL_VIEW". An
important class name to remember is the class name of the AOL program itself.
This class name is "AOL Frame25".

These class names are one of 2 ways used to locate items. The other is by
title.

AOL% = FindWindow("AOL Frame25", 0&)

Look at this line and try see what it does. The FindWindow declaration goes
something like this (this is actually 1 long line)

Our first parameter is the Class Name of the program we're looking for. We
know the class name of AOL is "AOL Frame25". The second is the window name.
You might put "America  Online" here, but if you ever tried maximizing a
window in AOL, you'd see the title changes, so using "America  Online" would
fail if anything was maximized. Once this line is executed, Windows will
return the handle of the AOL program in the variable AOL%. The first step to
locating items in AOL is complete. Now we have to find the MDI Client so that
we can look at all the windows in AOL.

MDI% = FindChildByClass(AOL%, "MDIClient")

Again look at every part of this line. Note that one of our parameters is
AOL%, which contains the handle to the AOL program, and our second parameter
is the class name of what we're looking for. What this is doing is telling
Windows to look at AOL%, and find a child in it which has a class name of
"MDIClient". At this point we have the handle of the MDI Client and we're
ready to look for child forms like Favorite Places, the chat room, and
Instant Message windows. Let's look at our Favorite Places example again.

AOL --> MDIClient --> Favorite Places

We located the handle to AOL and the handle of the MDI Client.

FavPlaces% = FindChildByTitle(MDI%, "Favorite Places")

Notice that we use MDI%, and we don't use AOL%. This is because Favorite
Places is a child of the MDI Client. You can go even further and find things
like buttons in the Favorite Places window by using FavPlaces% instead of
MDI% and searching by title. Think about how the code to locating the "Add
Favorite Place" button would work. Its a child of the Favorite Places window,
and we have the favorite places handle in a variable now, and the
FindChildByTitle. Think about this before you scroll down and look at the
answer.



















AddFavPlace% = FindChildByTitle(FavPlaces%, "Add Favorite Place")

Simple isnt it? I'll end this lesson at this point. More to come later. Try
and understand how this all works.

~EV   iVe   
