Chapter 11. The Windows API

The Windows API has a bad rap among many Access programmers who think it’s too hard to figure out, too hard to call, or just plain mysterious. We’re here to prove that none of these is the case—even if you’ve never seen the Windows API programmer’s reference, you can use the Windows API, given some help. In this chapter, we’ll present some interesting uses of the Windows API from within Access, with example forms and modules for each solution. In most cases, using these in your own applications entails little more than simply importing a module or two and then calling the functions. We’ve divided the solutions in this chapter into three broad categories, as follows:

The Windows user interface

You’ll learn how to remove a form’s system menu, how to maximize and minimize buttons at runtime, and how to draw attention to a specific form by flashing its titlebar or icon. We’ll discuss language-independent classification of keypresses, so you can monitor exactly what keys have been pressed. We’ll also show how to restrict mouse movement to a specific area on the screen.

The Windows shell

You’ll learn how to have asynchronous code run another program and pause until the other program is done before continuing. We’ll demonstrate a method for shutting down Windows under program control and show you all the options of the associated API functions. You’ll learn to find and run an application, given an associated data file, and how to determine if the application is ...

Get Access Cookbook 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.