stdafx.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // stdafx.cpp : 只包括标准包含文件的源文件
  2. // test.pch 将作为预编译头
  3. // stdafx.obj 将包含预编译类型信息
  4. #include "stdafx.h"
  5. // TODO: 在 STDAFX.H 中
  6. // 引用任何所需的附加头文件,而不是在此文件中引用
  7. //////////////////////////////////////////////////////////////////////////
  8. // 用例;
  9. HMODULE g_hlogdll = NULL;
  10. log_Start g_logStart = NULL;
  11. log_Stop g_logStop = NULL;
  12. log_enable g_logEnable = NULL;
  13. log_Setlogpath g_Setlogpath = NULL;
  14. log_Getlogpath g_Getlogpath = NULL;
  15. log_GetTime g_GetTime = NULL;
  16. BOOL LoadLogLibarary()
  17. {
  18. if ( g_hlogdll == NULL )
  19. {
  20. g_hlogdll = (HMODULE)LoadLibrary(_T("logmodule.dll"));
  21. if (!g_hlogdll)
  22. return FALSE;
  23. }
  24. g_logStart = (log_Start)GetProcAddress(g_hlogdll, "StartServer");
  25. if ( !g_logStart )
  26. {
  27. FreeLogLibarary();
  28. return FALSE;
  29. }
  30. g_logStop = (log_Stop)GetProcAddress(g_hlogdll, "StopServer");
  31. if ( !g_logStop )
  32. {
  33. FreeLogLibarary();
  34. return FALSE;
  35. }
  36. g_logEnable = (log_enable)GetProcAddress(g_hlogdll, "EnableWriteLog");
  37. if ( !g_logEnable )
  38. {
  39. FreeLogLibarary();
  40. return FALSE;
  41. }
  42. g_Setlogpath = (log_Setlogpath)GetProcAddress(g_hlogdll, "SetCaselogPath");
  43. if ( !g_Setlogpath )
  44. {
  45. FreeLogLibarary();
  46. return FALSE;
  47. }
  48. g_Getlogpath = (log_Getlogpath)GetProcAddress(g_hlogdll, "GetCaselogPath");
  49. if ( !g_Getlogpath )
  50. {
  51. FreeLogLibarary();
  52. return FALSE;
  53. }
  54. g_GetTime= (log_GetTime)GetProcAddress(g_hlogdll, "GetReceivePrintTime");
  55. if ( !g_GetTime )
  56. {
  57. FreeLogLibarary();
  58. return FALSE;
  59. }
  60. return TRUE;
  61. }
  62. void FreeLogLibarary()
  63. {
  64. if ( g_hlogdll )
  65. {
  66. if ( FreeLibrary(g_hlogdll) )
  67. {
  68. g_hlogdll = NULL;
  69. g_logStart = NULL;
  70. g_logStop = NULL;
  71. }
  72. }
  73. }