When an application is about to close, it should destroy all Microsoft?DirectInput?objects. This is a three-step process.
For a sample function that closes down the DirectInput system, see Sample Function 2: DI_Term.