home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / addins / replall / stdafx.h < prev   
C/C++ Source or Header  |  1998-04-02  |  2KB  |  73 lines

  1. // stdafx.h : include file for standard system include files,
  2. //  or project specific include files that are used frequently, but
  3. //      are changed infrequently
  4. //
  5.  
  6. #if !defined(AFX_STDAFX_H__14334315_B34A_11D0_A217_244106C10000__INCLUDED_)
  7. #define AFX_STDAFX_H__14334315_B34A_11D0_A217_244106C10000__INCLUDED_
  8.  
  9. #define VC_EXTRALEAN        // Exclude rarely-used stuff from Windows headers
  10.  
  11. #include <afxwin.h>         // MFC core and standard components
  12. #include <afxdisp.h>
  13.  
  14. #include <atlbase.h>
  15. //You may derive a class from CComModule and use it if you want to override
  16. //something, but do not change the name of _Module
  17. extern CComModule _Module;
  18. #include <atlcom.h>
  19.  
  20. // Developer Studio Object Model
  21. #include <ObjModel\addauto.h>
  22. #include <ObjModel\appdefs.h>
  23. #include <ObjModel\appauto.h>
  24. #include <ObjModel\blddefs.h>
  25. #include <ObjModel\bldauto.h>
  26. #include <ObjModel\textdefs.h>
  27. #include <ObjModel\textauto.h>
  28. #include <ObjModel\dbgdefs.h>
  29. #include <ObjModel\dbgauto.h>
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // Debugging support
  33.  
  34. // Use VERIFY_OK around all calls to the Developer Studio objects which
  35. //  you expect to return S_OK.
  36. // In DEBUG builds of your add-in, VERIFY_OK displays an ASSERT dialog box
  37. //  if the expression returns an HRESULT other than S_OK.  If the HRESULT
  38. //  is a success code, the ASSERT box will display that HRESULT.  If it
  39. //  is a failure code, the ASSERT box will display that HRESULT plus the
  40. //  error description string provided by the object which raised the error.
  41. // In RETAIL builds of your add-in, VERIFY_OK just evaluates the expression
  42. //  and ignores the returned HRESULT.
  43.  
  44. #ifdef _DEBUG
  45.  
  46. void GetLastErrorDescription(CComBSTR& bstr);        // Defined in ReplAll.cpp
  47. #define VERIFY_OK(f) \
  48.     { \
  49.         HRESULT hr = (f); \
  50.         if (hr != S_OK) \
  51.         { \
  52.             if (FAILED(hr)) \
  53.             { \
  54.                 CComBSTR bstr; \
  55.                 GetLastErrorDescription(bstr); \
  56.                 _RPTF2(_CRT_ASSERT, "Object call returned %lx\n\n%S", hr, (BSTR) bstr); \
  57.             } \
  58.             else \
  59.                 _RPTF1(_CRT_ASSERT, "Object call returned %lx", hr); \
  60.         } \
  61.     }
  62.  
  63. #else //_DEBUG
  64.  
  65. #define VERIFY_OK(f) (f);
  66.  
  67. #endif //_DEBUG
  68.  
  69. //{{AFX_INSERT_LOCATION}}
  70. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  71.  
  72. #endif // !defined(AFX_STDAFX_H__14334315_B34A_11D0_A217_244106C10000__INCLUDED)
  73.