stdafx.cpp 889 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // stdafx.cpp : 只包括标准包含文件的源文件
  2. // WxService.pch 将作为预编译头
  3. // stdafx.obj 将包含预编译类型信息
  4. #include "stdafx.h"
  5. // TODO: 在 STDAFX.H 中
  6. // 引用任何所需的附加头文件,而不是在此文件中引用
  7. HMODULE g_hpool = NULL;
  8. IWxAdoInterface* g_pAdoPool = NULL;
  9. typedef IWxAdoInterface* (*CREATEINSTANCE)();
  10. BOOL CreatePoolInstance()
  11. { //加载动态库
  12. g_hpool = (HMODULE)LoadLibrary(_T("WxAdoInterface.dll"));
  13. if (g_hpool == NULL)
  14. {
  15. CString strError = _T("");
  16. strError.Format(_T("error = %d"), GetLastError());
  17. return FALSE;
  18. }
  19. CREATEINSTANCE CreaetInstance = (CREATEINSTANCE)GetProcAddress(g_hpool, "CreateWxAdoPoolInstance");
  20. g_pAdoPool = CreaetInstance();
  21. return (g_pAdoPool == NULL) ? FALSE : TRUE;
  22. }
  23. void FreelyfzodbcLibrary()
  24. {
  25. if (g_hpool)
  26. {
  27. g_pAdoPool->ReleasePool();
  28. g_pAdoPool->Release();
  29. FreeLibrary(g_hpool);
  30. }
  31. g_hpool = NULL;
  32. g_pAdoPool = NULL;
  33. }