| | It is particularly important to have a clear understanding of the differences between passing by value and passing by reference, because when dealing with API function calls, a slip here will generally mean a GPF. | | | | | | The Windows API functions are implemented in dynamic link libraries (DLLs), so it might be a good idea to briefly discuss DLLs and how they work. We will have much more to say about DLLs later in the book. | | | | | | A dynamic link library, or DLL for short, is an executable file that contains one or more exportable functions, that is, functions that can be called from another executable (EXE or DLL). In many ways, DLLs are much simpler than EXE files, since they do not contain code to manage a graphical interface or to process Windows messages, for instance. | | | | | | To clarify the terminology, an executable file, also called an image file, is a file that adheres to the Portable Executable (PE) file format specification. These files include EXE and DLL files, as well as OCX, DRV, and other files. To confuse matters, the term executable file is often used to refer to EXE files only. (We will devote an entire chapter to the PE file format.) | | | | | | Unfortunately, Visual Basic cannot create traditional DLLs. It is capable of creating a very useful form of DLL called an ActiveX server. However, these DLLs do not export functions in the traditional manner. Rather, they export Automation objects, along with their properties and methods. For this reason, they are also called Automation servers. We will speak no more about these special types of DLLs. | | | | | | To say that DLLs are ubiquitous under the Windows operating system seems like an incredible understatement. For instance, the Windows NT system that I am using to write this book currently has no fewer than 1,029 distinct DLLs on the hard disk, taking about 93 megabytes of disk space! | | | | | | Windows uses several DLLs to house the Win32 API functions. In fact, most of the more than 2,000 functions in the Win32 API are contained in three DLLs: | | | | | | | | | KERNEL32.DLL Exports about 700 functions that manage memory, processes, and threads | | | | | | | | | USER32.DLL Exports about 600 functions that control the user interface, such as creating windows and sending messages | | | | | | | | | GDI32.DLL Exports about 400 functions for drawing graphical images, displaying text, and manipulating fonts | | | | | | In addition to these DLLs, Windows also includes several other DLLs for more specialized tasks. Following are some examples. | | | | |