Microsoft DirectX 9.0

DeviceView Sample


This sample shows how the DIDevImage framework provided with the samples, located in the (SDK root)\samples\C++\Common folder, can be used to create a custom device configuration interface.

DIDevImage framework handles issues such as bookkeeping involved with bitmaps, ToolTips, and image scaling. If extra functionality is needed, you can modify the source code for the DIDevImage framework at (SDK root)\samples\cpp\common\src\didevimg.cpp.


Source: (SDK root)\Samples\Multimedia\DirectInput\DeviceView

Executable: (SDK root)\Samples\Multimedia\DirectInput\Bin\DeviceView.exe

User's Guide

When you run the application, it will display a tab for each Microsoft?DirectInput?device on your system. For each device, you scroll through multiple pages by entering a value for the desired page or by using the scroll arrows.

To select a device object, click the mouse on the name of the device or activate the device object. This will highlight the name of the current device object and display the object's image overlay (if available).

To hide unmapped objects, select the Hide Unmapped check box.

Programming Notes

This sample is built on the DIDevImage framework, which handles the device image loading, scaling, and rendering. To use the framework:

  1. Create an instance of the CDIDevImage class.
  2. Initialize the CIDevImage object by passing a pointer to an IDirectInputDevice8 object to the CIDevImage::Init method.
  3. Set the desired names associated with each object through a series of calls to the CIDevImage::SetCalloutText method.
  4. Render the image associated with the object to your client application by passing either a device context to the CIDevImage::RenderToDC method, or an IDirect3DTexture9 object to the CIDevImage::Render method.
  5. Highlight, display full name, or hide names associate with each object by passing the appropriate flags to the DIDevImage::SetCalloutState method.

The CIDevImage framework has some optimizations for quick renderings, but your application should not call the Render method for each frame. Instead, try to call the framework's Render method only when the device image changes due to user input.

Read the inline comments included with the CIDevImage framework source code for information about using some of the more advanced features, such as transparent backgrounds for Microsoft Direct3D?surfaces.

It is not necessary to create a device configuration user interface (UI). DirectInput provides a UI that can be customized and is called by the IDirectInput8::ConfigureDevices method. The source code for the default UI is also provided with this software development kit (SDK) (samples\cpp\DirectInput\diconfig). The DirectInput UI, as well as the DIDevImage framework UI, call the IDirectInputDevice8::GetImageInfo method to retrieve the device images.

© 2002 Microsoft Corporation. All rights reserved.