The Windows APIThe Windows API is a collection of routines available to you, the Visual Basic programmer. In a way, these API routines work just like Visual Basic's own internal functions. When you need to use the code in an API routine, your Visual Basic program calls that routine. When the Windows API finishes, control returns to your program so that it can continue. So many Windows API routines exist that just about anything you can do from Windows, you can do from a Visual Basic application by calling the appropriate Windows API routine. For example, you can even force a system reboot by calling the appropriate Windows API routine.
All the Windows API routines are stored in special files called DLLs. Several thousand API routines are available for use. These API routines appear in files stored in your Windows and Windows\System folders. When you install Windows, the DLL files install as well; therefore, you have access to these libraries automatically.
Most DLL files have the .DLL filename extension or the .EXE filename extension. Any program you write has access to the Windows DLLs. These same DLLs were part of older Windows versions as well (before Windows 95), except that these files didn't have "32" in their names, designating them as 32-bit compatible. Pre[nd]Windows 95 versions were 16-bit compatible, meaning that data traveled through the system 16 bits (two bytes) at a time. Programming in a 32-bit environment adds much more flexibility, speed, and efficiency over the older 16-bit environment. Here are the three most common DLL libraries:
These three files hold most of the API routines, or functions, that you'll call from your Visual Basic applications. As you glance through your Windows and Windows\System folders, you'll see other dynamic link libraries, as well, with names such as COMDLG.DLL, MAPI32.DLL, NETAPI32.DLL, and WINMM.DLL. As Microsoft adds features to the operating system, new DLL files appear. DLLs are not just part of Windows. When you add a new application to your system, that application often supplies its own DLL. Therefore, over time, many DLL files begin to appear in your system.
|
|
![]() |
![]() |
|||