home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / addins / api2help / stdafx.h < prev    next >
C/C++ Source or Header  |  1998-04-02  |  3KB  |  77 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. // Copyright (C) 1992-1998 Microsoft Corporation
  7. // All rights reserved.
  8.  
  9.  
  10. #if !defined(AFX_STDAFX_H__17A2229F_431B_11D0_B88F_00C04FD7A0F0__INCLUDED_)
  11. #define AFX_STDAFX_H__17A2229F_431B_11D0_B88F_00C04FD7A0F0__INCLUDED_
  12.  
  13. #define VC_EXTRALEAN        // Exclude rarely-used stuff from Windows headers
  14.  
  15. #include <afxwin.h>         // MFC core and standard components
  16. #include <afxdisp.h>
  17.  
  18. #include <atlbase.h>
  19. //You may derive a class from CComModule and use it if you want to override
  20. //something, but do not change the name of _Module
  21. extern CComModule _Module;
  22. #include <atlcom.h>
  23.  
  24. // Developer Studio Object Model
  25. #include <ObjModel\addauto.h>
  26. #include <ObjModel\appdefs.h>
  27. #include <ObjModel\appauto.h>
  28. #include <ObjModel\blddefs.h>
  29. #include <ObjModel\bldauto.h>
  30. #include <ObjModel\textdefs.h>
  31. #include <ObjModel\textauto.h>
  32. #include <ObjModel\dbgdefs.h>
  33. #include <ObjModel\dbgauto.h>
  34.  
  35. /////////////////////////////////////////////////////////////////////////////
  36. // Debugging support
  37.  
  38. // Use VERIFY_OK around all calls to the Developer Studio objects which
  39. //  you expect to return S_OK.
  40. // In DEBUG builds of your add-in, VERIFY_OK displays an ASSERT dialog box
  41. //  if the expression returns an HRESULT other than S_OK.  If the HRESULT
  42. //  is a success code, the ASSERT box will display that HRESULT.  If it
  43. //  is a failure code, the ASSERT box will display that HRESULT plus the
  44. //  error description string provided by the object which raised the error.
  45. // In RETAIL builds of your add-in, VERIFY_OK just evaluates the expression
  46. //  and ignores the returned HRESULT.
  47.  
  48. #ifdef _DEBUG
  49.  
  50. void GetLastErrorDescription(CComBSTR& bstr);       // Defined in API2Help.cpp
  51. #define VERIFY_OK(f) \
  52.     { \
  53.         HRESULT hr = (f); \
  54.         if (hr != S_OK) \
  55.         { \
  56.             if (FAILED(hr)) \
  57.             { \
  58.                 CComBSTR bstr; \
  59.                 GetLastErrorDescription(bstr); \
  60.                 _RPTF2(_CRT_ASSERT, "Object call returned %lx\n\n%S", hr, (BSTR) bstr); \
  61.             } \
  62.             else \
  63.                 _RPTF1(_CRT_ASSERT, "Object call returned %lx", hr); \
  64.         } \
  65.     }
  66.  
  67. #else //_DEBUG
  68.  
  69. #define VERIFY_OK(f) (f);
  70.  
  71. #endif //_DEBUG
  72.  
  73. //{{AFX_INSERT_LOCATION}}
  74. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  75.  
  76. #endif // !defined(AFX_STDAFX_H__17A2229F_431B_11D0_B88F_00C04FD7A0F0__INCLUDED)
  77.