Index   Commented   Search   About

Destroying the HRC

The useful life of an HRC object usually expires when the recognizer returns results at the end of an input session. The next input session requires the creation of a new HRC. When finished with an HRC object, an application should destroy the object in two steps:

  1. Call DestroyHRC to free the occupied memory.

  2. Set the HRC handle to NULL.

For example:

HRC vhrc = NULL; // Set to NULL until HRC is created

.

. // Create and use the HRC

.

DestroyHRC( vhrc ); // Destroy the HRC when finished

  • hrc = NULL; // Handle is now invalid

When DestroyHRC returns, the handle value remains unchanged though no longer valid. The second step above prevents frustrating bugs arising from the inadvertent use of an invalid HRC handle.

This same advice applies to the other recognition objects, HRCRESULT and HWL. After calling DestroyHRCRESULT or DestroyHWL, always set the invalid handle to NULL.

Related Links

Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference (win32.hlp)
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008 Free Tect Secrets ;) greatis just4fun network just4fun