HelpContext and HelpFile Properties Example (VC++)

This example displays the HelpContext and HelpFile properties of an Error object. The HelpFile property contains the name of the Microsoft Jet database engine error message Help file.

CdbDBEngine   dbeng;
//   
try
{
   throw (E_DAO_DatabaseInvalidName);   //error 3005
}
catch (CdbException)
{
   CdbError err = dbeng.Errors[0L];
   CString stMsg, stTitle;
   //
   stTitle =  
      err.GetDescription() +
      stMsg.Format(_T("%ld"), err.GetHelpContext()) +
      err.GetHelpFile();
   stMsg =    "Press F1 or Help to see " + 
            err.GetHelpFile() + 
            " topic for this error";
   MessageBox( 
      NULL, stMsg, _T("Error: " + stTitle), MB_OK);
}