Introduction
In this chapter, you learn the mysticism behind the
Windows API and how simple it is to use them in your
application. Although VB can do just anything you
need, some applications require features that VB cannot
perform without tedious programming on your part.
Fortunately, you can use routines that are already
available elsewhere in Windows-such as those you write
in C or C++ and store in DLLs. Almost all operating
systems have API library functions that you can call
so you don't have to keep re-creating the wheel. By
utilizing these routines, you can extend the power
of VB and make it perform some functions that only
Windows has the true authority to perform.
The Windows API, or Application Programming Interface,
is a set of internal routines you can call from
Visual Basic. |
All the Windows API routines are stored in special
files called DLLs. These API appear in files stored
in your Windows and Windows\System folders.
Dynamic Link Libraries, are code libraries that
contain functions and procedures. |
The word dynamic is a reference to the fact that,
unlike traditional code libraries that are linked
into your application during compile time, DLLs are
loaded while the application is executing. When the
application calls a function in DLL, the DLL is loaded
into memory, the function executes, and returns information
to the application, just like a standard compiled
call.
The three most common DLLs:
- USER32.DLL :
Contains functions that control the Windows environment
and the user's interface, such as cursors, menus,
and windows.
- GDI32.DLL :
Contains functions that control output to the
screen and other devices.
- KERNEL32.DLL :
Contains functions that control the internal Windows
hardware and software interface. Most of the memory,
file, and directory service routines are located
in KERNEL32.DLL.
|