Chapter 2. Extending Applications Using the Windows API

VBA simplifies certain tasks, such as reading data from files, asking the user for information, or even launching an external application. As a programming language, it also does a good job at preventing you from shooting yourself in the foot. As a result, a fair amount of functionality to developers of other languages, such as C++ or C#, is not available natively. Therefore, you utilize the Windows API to achieve some of this same functionality.

In this chapter, you learn how you can leverage the Windows API in your applications. More specifically, you learn the following:

  • How to translate an API function declaration written in C/C++ to VBA

  • How to use the API to retrieve information about the system

  • How to control processes and threads, and work with the Windows shell

  • How to use new task dialogs in Windows Vista that allow you to create exciting user interfaces for your applications running on Vista

Windows API Overview

The Windows API contains literally thousands of functions that can be used to perform a wide variety of tasks ranging from retrieving information about the system, to printing, to creating processes, to well, you name it. Virtually everything that Windows does as an operating system can be accomplished using the API.

Why Use API Functions

VBA is a great language, and along with C#, it is certainly our favorite. It contains many powerful features that we as developers use to provide very rich applications to our users. ...

Get Expert Access™ 2007 Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.