## Sample Applications

This release of Active Accessibility includes sample implementations of Active Accessibility clients and servers. Samples are all written using C++. The following samples are included.

- Inspect Objects
- Accessible Event Watcher
- Snapshot Utility
- Input Applet
- DDIHook Applet
- OACSpy Applet
- Server Applet
- Babble Applet
- VBINSP

### Inspect Objects

The Inspect Objects (Inspect.exe) sample hooks global keystroke combinations, even when it is not the active application. The sample has several shortcut keys you can use to activate its various options.

Key combination | Menu command | Action
CTRL+SHIFT+F2 | Get Properties | Retrieves the object properties of the object under the cursor.
CTRL+SHIFT+F3 | Do Default Actions | Invokes the default action of the object under the cursor.
CTRL+SHIFT+F4 | Select | Selects the object under the cursor.
CTRL+SHIFT+F5 | Focus | Sets the keyboard focus to the object under the cursor.
CTRL+SHIFT+F6 | Move to Next | Moves the cursor to the next object in logical order from the one under the cursor.
CTRL+SHIFT+F7 | Move to Previous | Moves the cursor to the previous object in logical order from the one under the cursor.
CTRL+SHIFT+F8 | Move Left | Moves the cursor to the peer object to the left of the one it is over.
CTRL+SHIFT+F9 | Move Above | Moves move the cursor to the peer object above the object it is over.
CTRL+SHIFT+F10 | System Menu | Bring up the system menu.
CTRL+SHIFT+F11 | Move Right | Moves the cursor to the peer object to the right of the one it is over.
CTRL+SHIFT+F12 | Move Below | Moves the cursor to the peer object below the one it is over.

When performing object navigation, the application will produce a beep if no object is available to move to.

Other options for this sample application are accessed through the sample's system menu. The Watch Focus command instructs the sample to follow the keyboard focus; the Watch Caret command tells the sample to follow the caret. When Watch Focus is on, the sample installs an asynchronous focus event hook, and moves the caret to the top left of the object with the focus. This causes Inspect to refresh its properties in about one second.

Something to keep in mind, that Inspect always uses the screen location to navigate from.

When using Office '97, an out-of-context procedure has better performance than an in-context procedure does. An in-context hook procedure is located in a dynamic-link library (DLL) that Active Accessibility maps into the server's address space. Similarly, an out-of-context hook procedure is located in the client's address space, whether it's in the code body or in a DLL.

### Accessible Event Watcher

The simple Accessible Event Watcher (Accevent.exe) application logs the following types of events as they occur within the system.

Event Type | Event Name
Creation or Destruction | EVENT_OBJECT_CREATE, EVENT_OBJECT_DESTROY
Location | EVENT_OBJECT_REORDER, EVENT_OBJECT_PARENTCHANGE, EVENT_OBJECT_LOCATIONCHANGE
State | EVENT_OBJECT_STATECHANGE, EVENT_OBJECT_SHOW, EVENT_OBJECT_HIDE
Focus or Selection | EVENT_OBJECT_FOCUS, EVENT_OBJECT_SELECTION, EVENT_OBJECT_SELECTIONADD, EVENT_OBJECT_SELECTIONREMOVE, EVENT_OBJECT_SELECTIONWITHIN
Description | EVENT_OBJECT_NAMECHANGE, EVENT_OBJECT_VALUECHANGE, EVENT_OBJECT_DESCRIPTIONCHANGE
Other | EVENT_OBJECT_HELPCHANGE, EVENT_OBJECT_DEFACTIONCHANGE, and others
Caret | For caret object events
Cursor | For cursor object events
Mode | For modality events (like EVENT_SYSTEM_MOVESIZESTART, EVENT_SYSTEM_MOVESIZEEND, and others)

Warning: Do not use this sample while the OACSpy application is spying on event notifications. If both applications are active, they will log each other's events, generating events in the process. This causes an endless loop.

### Snapshot Utility

The Snapshot utility (Snapshot.exe) enables you to pick a top-level window, and then dumps recursively in outline fashion all the accessible objects within that window. It has an option to skip invisible objects. It will also enable you to save the outline to a file in text format, with tabs used for indenting.

### Input Applet

The dialog box-based Input applet (Input.exe) exercises the various input APIs.

### DDIHook Applet

The DDIHook sample program (DDIHook.exe) shows how to get DDI information. The actual callback is called in a 16-bit DLL, that passes the information up to a 32-bit component, that saves the DDI information in a text file.

### OACSpy Applet

With the OACSpy applet (OACSpy.exe), you can verify that a 32-bit application supports Active Accessibility in Windows 95 (previously known as OleACcessibility).

OACSpy verifies that an application supports WM_GETOBJECT and NotifyWinEvent.

Follow these steps to use OACSpy to test selection change and notifications:

1. Run OACSpy.exe.
2. Activate the Spy menu and choose the Selection Notification command to display the Selection Notification dialog box.
3. OACSpy displays detailed Active Accessibility information given any keyboard, focus, selection, or other notifications that the active application generates (even those that the system creates on the application's behalf).

Follow these steps to check if an application is responding correctly to the WM_GETOBJECT message:

1. Activate the Spy menu and choose the Windows command to invoke the Windows dialog box.
2. When the list of open windows appears, choose the one of interest to see its child windows.
3. Any window that supports the WM_GETOBJECT message has "OAC" as its class. The second list box shows details about the window. Additionally, you can place the cursor over any object outside OACSpy, and the OAC information under the cursor will be displayed.

Warning: Do not use this sample to spy on event notifications while the Accevent.exe application is running and active. If both applications are active, they will log each other's events, generating events in the process. This causes an endless loop.

### Server Applet

The Server sample application (Server.exe) was written purposely to be inaccessible. It does, however, expose the Active Accessibility interface to allow a client to operate it. It takes left mouse clicks to select an object from the dialog box's choices of icons. It has no menus.

### Babble Applet

Babble is a sample Active Accessibility client that uses the Microsoft Speech API to speak the properties of an object. Babble requires an SAPI-compliant speech engine, which is not provided as part of the Microsoft Active Accessibility SDK, in order to speak. Babble will compile and run, but it is not considered a complete applet. It is provided as sample source code only.

### VBINSP

This sample is written using Microsoft Visual Basic version 4.0. It performs a function similar to the Inspect Objects sample. Instead of waiting for the mouse to stop moving, this sample uses a timer to constantly query the object under the mouse. The VBINSP.BAS code module can be reused in other Visual Basic projects.

© 1997 Microsoft Corporation. All rights reserved. Legal Notices.