stdafx.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // stdafx.h : 标准系统包含文件的包含文件,
  2. // 或是经常使用但不常更改的
  3. // 特定于项目的包含文件
  4. //
  5. #pragma once
  6. #include "targetver.h"
  7. #define WIN32_LEAN_AND_MEAN // 从 Windows 头中排除极少使用的资料
  8. #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
  9. #ifndef VC_EXTRALEAN
  10. #define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
  11. #endif
  12. #include <afx.h>
  13. #include <afxwin.h> // MFC 核心组件和标准组件
  14. #include <afxext.h> // MFC 扩展
  15. #ifndef _AFX_NO_OLE_SUPPORT
  16. #include <afxole.h> // MFC OLE 类
  17. #include <afxodlgs.h> // MFC OLE 对话框类
  18. #include <afxdisp.h> // MFC 自动化类
  19. #endif // _AFX_NO_OLE_SUPPORT
  20. /*#include <ATLComTime.h>*/
  21. #ifndef _AFX_NO_DAO_SUPPORT
  22. #include <afxdao.h> // MFC DAO 数据库类
  23. #endif // _AFX_NO_DAO_SUPPORT
  24. #ifndef _AFX_NO_OLE_SUPPORT
  25. #include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
  26. #endif
  27. #ifndef _AFX_NO_AFXCMN_SUPPORT
  28. #include <afxcmn.h> // MFC 对 Windows 公共控件的支持
  29. #endif // _AFX_NO_AFXCMN_SUPPORT
  30. // TODO: 在此处引用程序需要的其他头文件
  31. #include "CritSection.h"
  32. #include "table.pb.h"
  33. // Ado//由于MFC封装的ODBC不太好用;
  34. #import "C:\Program Files\Common Files\System\ado\msado15.dll" rename_namespace("ADOCG") rename("EOF", "adoEOF")
  35. //#import "..\ado\msado15.dll" rename_namespace("ADOCG") rename("EOF", "adoEOF")
  36. #pragma warning (default: 4146) // 微软建议不要理会这个错误;
  37. using namespace ADOCG;
  38. extern void WriteTextLog(const TCHAR *format, ...);
  39. typedef struct __ADO__
  40. {
  41. _ConnectionPtr pConnection;
  42. _RecordsetPtr pRecordSet;
  43. _CommandPtr pCommand;
  44. //~__ADO__()
  45. //{
  46. // if (pCommand)
  47. // {
  48. // //pCommand->Close();
  49. // pCommand->Release();
  50. // }
  51. // if (pRecordSet)
  52. // {
  53. // pRecordSet->Close();
  54. // pRecordSet->Release();
  55. // }
  56. // if (pConnection)
  57. // {
  58. // pConnection->Close();
  59. // pConnection->Release();
  60. // }
  61. //}
  62. }AdoObj, *pAdoObj;
  63. #ifdef USE_ODBC
  64. #define DB_SS_CONN_WITH_PORT _T("driver={SQL Server};Server=%s,%d;database=%s;uid=%s;pwd=%s")
  65. #define DB_SS_CONN_WITHOUT_PORT _T("driver={SQL Server};Server=%s;database=%s;uid=%s;pwd=%s")
  66. #define DB_SS_CONN_WITHOUT_PORT2 _T("driver={SQL Server};Server=%s;database=%d;uid=%s;pwd=%s")
  67. #define DB_SW_CONN_WITH_PORT _T("Driver={SQL Server};Server=%s,%d;Database=%s;Trusted_Connection=yes;")
  68. #define DB_SW_CONN_WITHOUT_PORT _T("Driver={SQL Server};Server=%s;Database=%s;Trusted_Connection=yes;")
  69. #define DB_SW_CONN_WITHOUT_PORT2 _T("Driver={SQL Server};Server=%s;Database=%d;Trusted_Connection=yes;")
  70. #else
  71. #define DB_SS_CONN_WITH_PORT _T("Provider=sqloledb;Data Source=%s,%ld;Initial Catalog=%s;User Id=%s;Password=%s; ")
  72. #define DB_SS_CONN_WITHOUT_PORT _T("Provider=sqloledb;Data Source=%s;Initial Catalog=%s;User Id=%s;Password=%s; ")
  73. #define DB_SS_CONN_WITHOUT_PORT2 _T("Provider=sqloledb;Data Source=%s,%ld;Initial Catalog=%s;User Id=%s;Password=%s; ")
  74. #define DB_SW_CONN_WITH_PORT _T("Provider=sqloledb;Data Source=%s;Initial Catalog=%s;User Id=%s;Password=%s; ")
  75. #define DB_SW_CONN_WITHOUT_PORT _T("Provider=sqloledb;Data Source=%s;Initial Catalog=%s;Trusted_Connection=yes;")
  76. #define DB_SW_CONN_WITHOUT_PORT2 _T("Provider=sqloledb;Data Source=%s;Initial Catalog=%d;Trusted_Connection=yes;")
  77. #endif