stdafx.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. // STDAFX.H is the header that includes the standard includes that are used
  11. // for most of the project. These are compiled into a pre-compiled header
  12. // turn off warnings for /W4 (just for MFC implementation)
  13. #ifndef ALL_WARNINGS
  14. #pragma warning(disable: 4073) // disable warning about using init_seg
  15. #endif
  16. // MFC inline constructors (including compiler generated) can get deep
  17. #pragma inline_depth(16)
  18. #ifdef _AFX_DEVBUILD
  19. #define AFX_IMPL_DATA AFX_DATA_EXPORT
  20. #else
  21. #define AFX_IMPL_DATA
  22. #endif
  23. // override default values for data import/export when building MFC DLLs
  24. #ifdef _AFX_CORE_IMPL
  25. #define AFX_CORE_DATA AFX_IMPL_DATA
  26. #define AFX_CORE_DATADEF
  27. #endif
  28. #ifdef _AFX_OLE_IMPL
  29. #define AFX_OLE_DATA AFX_IMPL_DATA
  30. #define AFX_OLE_DATADEF
  31. #endif
  32. #ifdef _AFX_DB_IMPL
  33. #define AFX_DB_DATA AFX_IMPL_DATA
  34. #define AFX_DB_DATADEF
  35. #endif
  36. #ifdef _AFX_NET_IMPL
  37. #define AFX_NET_DATA AFX_IMPL_DATA
  38. #define AFX_NET_DATADEF
  39. #endif
  40. #define _AFX_NOFORCE_LIBS
  41. #define _AFX_FULLTYPEINFO
  42. #define VC_EXTRALEAN
  43. #define NO_ANSIUNI_ONLY
  44. #define _MFC_OVERRIDES_NEW
  45. #define AFX_COMDAT __declspec(selectany)
  46. // core headers
  47. #include "afx.h"
  48. #include "afxplex_.h"
  49. #ifndef WINSCP
  50. #include "afxcoll.h"
  51. #endif
  52. // public headers
  53. #ifndef WINSCP
  54. #include "afxwin.h"
  55. #include "afxdlgs.h"
  56. #include "afxext.h"
  57. #else
  58. #include "afxres.h"
  59. void AFXAPI AfxFormatString1(CString& rString, UINT nIDS, LPCTSTR lpsz1);
  60. void AFXAPI AfxFormatStrings(CString& rString, UINT nIDS,
  61. LPCTSTR const* rglpsz, int nString);
  62. void AFXAPI AfxFormatStrings(CString& rString, LPCTSTR lpszFormat,
  63. LPCTSTR const* rglpsz, int nString);
  64. inline HINSTANCE AFXAPI AfxGetResourceHandle()
  65. { ASSERT(afxCurrentResourceHandle != NULL);
  66. return afxCurrentResourceHandle; }
  67. #endif
  68. #ifndef _AFX_NO_OLEDB_SUPPORT
  69. #include "atlbase.h"
  70. #endif
  71. #ifndef _AFX_NO_OLE_SUPPORT
  72. #ifndef _OLE2_H_
  73. #include <ole2.h>
  74. #endif
  75. #include <winspool.h>
  76. // include OLE dialog/helper APIs
  77. #ifndef _OLEDLG_H_
  78. #include <oledlg.h>
  79. #endif
  80. #include <winreg.h>
  81. #include "afxcom_.h"
  82. #include "afxole.h"
  83. #include "afxdtctl.h"
  84. #include "afxdocob.h"
  85. #ifndef _AFX_NO_DAO_SUPPORT
  86. #include "afxdao.h"
  87. #endif
  88. #include "afxodlgs.h"
  89. #endif
  90. #ifndef _AFX_NO_OCX_SUPPORT
  91. #include "afxctl.h"
  92. #endif
  93. #ifndef _AFX_NO_DB_SUPPORT
  94. #include "afxdb.h"
  95. #endif
  96. #ifndef _AFX_NO_SYNC_SUPPORT
  97. #include "afxmt.h"
  98. #endif
  99. #ifndef _AFX_NO_INET_SUPPORT
  100. #include "afxinet.h"
  101. #endif
  102. // private headers as well
  103. #ifndef WINSCP
  104. #include "afxpriv.h"
  105. #else
  106. int AFXAPI AfxLoadString(UINT nIDS, LPTSTR lpszBuf, UINT nMaxBuf = 256);
  107. #endif
  108. #ifndef WINSCP
  109. #include "afximpl.h"
  110. #include "winhand_.h"
  111. #else
  112. #define _countof(array) (sizeof(array)/sizeof(array[0]))
  113. BOOL AFXAPI AfxFullPath(LPTSTR lpszPathOut, LPCTSTR lpszFileIn);
  114. void AFXAPI AfxGetRoot(LPCTSTR lpszPath, CString& strRoot);
  115. #endif
  116. #ifndef _AFX_NO_OLE_SUPPORT
  117. #ifndef WINSCP
  118. #include "oleimpl2.h"
  119. #endif
  120. #endif
  121. #ifndef _AFX_NO_OCX_SUPPORT
  122. #include "ctlimpl.h"
  123. #endif
  124. #ifndef _AFX_NO_DB_SUPPORT
  125. #include "dbimpl.h"
  126. #endif
  127. #ifndef _AFX_NO_DAO_SUPPORT
  128. #include "daoimpl.h"
  129. #endif
  130. #ifndef _AFX_NO_SOCKET_SUPPORT
  131. #ifndef _WINSOCKAPI_
  132. #include <winsock.h>
  133. #endif
  134. #include "sockimpl.h"
  135. #include "afxsock.h"
  136. #endif
  137. #ifndef _AFX_NO_AFXCMN_SUPPORT
  138. #include "afxcmn.h"
  139. #include "afxcview.h"
  140. #endif
  141. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  142. #include "afxrich.h"
  143. #endif
  144. #ifndef _AFX_NO_DHTML_SUPPORT
  145. #include "afxhtml.h"
  146. #endif
  147. #include <winreg.h>
  148. #include <winnls.h>
  149. #include <stddef.h>
  150. #include <limits.h>
  151. #include <malloc.h>
  152. #include <new.h>
  153. #ifndef _AFX_OLD_EXCEPTIONS
  154. #ifndef WINSCP
  155. #include <eh.h> // for set_terminate
  156. #endif
  157. #endif
  158. #undef AfxWndProc
  159. // implementation uses _AFX_PACKING as well
  160. #ifdef _AFX_PACKING
  161. #ifndef ALL_WARNINGS
  162. #pragma warning(disable: 4103)
  163. #endif
  164. #ifndef __BORLANDC__
  165. // In Borland C++ we set the packing to 4 in the BCC32.CFG file
  166. // This is because the inclusion of the following pragma line disables our
  167. // Pre-Compiled-Headers
  168. #pragma pack(_AFX_PACKING)
  169. #endif // __BORLANDC__
  170. #endif
  171. // special exception handling just for MFC library implementation
  172. #ifndef _AFX_OLD_EXCEPTIONS
  173. // MFC does not rely on auto-delete semantics of the TRY..CATCH macros,
  174. // therefore those macros are mapped to something closer to the native
  175. // C++ exception handling mechanism when building MFC itself.
  176. #undef TRY
  177. #define TRY { try {
  178. #undef CATCH
  179. #define CATCH(class, e) } catch (class* e) \
  180. { ASSERT(e->IsKindOf(RUNTIME_CLASS(class))); UNUSED(e);
  181. #undef AND_CATCH
  182. #define AND_CATCH(class, e) } catch (class* e) \
  183. { ASSERT(e->IsKindOf(RUNTIME_CLASS(class))); UNUSED(e);
  184. #undef CATCH_ALL
  185. #define CATCH_ALL(e) } catch (CException* e) \
  186. { { ASSERT(e->IsKindOf(RUNTIME_CLASS(CException))); UNUSED(e);
  187. #undef AND_CATCH_ALL
  188. #define AND_CATCH_ALL(e) } catch (CException* e) \
  189. { { ASSERT(e->IsKindOf(RUNTIME_CLASS(CException))); UNUSED(e);
  190. #undef END_TRY
  191. #define END_TRY } catch (CException* e) \
  192. { ASSERT(e->IsKindOf(RUNTIME_CLASS(CException))); e->Delete(); } }
  193. #undef THROW_LAST
  194. #define THROW_LAST() throw
  195. // Because of the above definitions of TRY...CATCH it is necessary to
  196. // explicitly delete exception objects at the catch site.
  197. #define DELETE_EXCEPTION(e) do { e->Delete(); } while (0)
  198. #define NO_CPP_EXCEPTION(expr)
  199. #else //!_AFX_OLD_EXCEPTIONS
  200. // In this case, the TRY..CATCH macros provide auto-delete semantics, so
  201. // it is not necessary to explicitly delete exception objects at the catch site.
  202. #define DELETE_EXCEPTION(e)
  203. #define NO_CPP_EXCEPTION(expr) expr
  204. #endif //_AFX_OLD_EXCEPTIONS
  205. #define min std::min
  206. #define max std::max
  207. #ifdef WINSCP
  208. class CMessageException : public CException
  209. {
  210. public:
  211. CMessageException(LPCTSTR Message);
  212. virtual BOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError, PUINT pnHelpContext = NULL);
  213. private:
  214. CString mMessage;
  215. };
  216. #endif
  217. /////////////////////////////////////////////////////////////////////////////