Learning more about API functions

Working with the Windows API functions can be tricky. Many programming reference books list the declarations for common API calls and often provide examples. Usually, you can simply copy the declarations and use the functions without really understanding the details. In reality (at least the reality that I've seen), most Excel programmers take a cookbook approach to API functions. The Internet has hundreds of examples that can be copied and pasted and that work quite reliably.

The companion CD-ROM includes a file named win32api.txt, which is a text file that contains Windows API declarations and constants.You can open this file with a text editor and copy the appropriate declarations to a VBA module.

If you develop applications that need to work in all versions of Excel, be aware of some potentially serious compatibility issues that arise when you use API calls. For example, if you develop an application using Excel 97, or later, that uses API calls, the application will not run with Excel 5 — even if you save the workbook in the Excel 5 format — because Excel 5 is a 16-bit application. Excel 97 and later versions are 32-bit applications. Refer to Chapter 26 for additional information and tips on how to circumvent this problem.

Chapter 11

Was this article helpful?

0 0

Post a comment