The API Functions

Visual Studio 6.0

Although you'll find well over a hundred properties and methods covered in this chapter, we actually used only a few API calls. These API calls generally fall into one of three classes of functions:

  • Functions that return a single value. GetComputerName, for example, returns only the name of the current computer, and GetCaretBlinkTime simply returns the number of milliseconds between “blinks” of the text-insert caret.

  • Functions that allow you to specify one of any number of parameter values and return different pieces of information depending on the “question” you asked. GetSystemMetrics and SystemParametersInfo fall into this category. These functions allow you to choose an item of interest from a documented list of items, and each returns a single piece of information, based on the value you supplied.

  • Functions that allow you to pass in a single data structure, which the function fills in with various pieces of information: GlobalMemoryStatus, GetSystemInfo, and GetSystemPowerStatus all fall into this category. Normally, for this type of function, the wrapper class calls the function in response to each property Get procedure, and the property returns just the element of the structure you require.

The next few sections discuss how you use the second and third types of function (calling the first type is so simple it requires no extra explanation) and demonstrate their usage by presenting examples from this chapter's class modules.

© 1997 by SYBEX Inc. All rights reserved.