stdafx.cpp 798 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // stdafx.cpp : 只包括标准包含文件的源文件
  2. // TestCase.pch 将作为预编译头
  3. // stdafx.obj 将包含预编译类型信息
  4. #include "stdafx.h"
  5. // 声明函数指针;
  6. LOADCUSTOMERJPG g_pfLoadCustomerJPG = NULL;
  7. // 声明dll模块;
  8. HMODULE g_hMyDll = NULL;
  9. BOOL LoadTestCaseDll()
  10. {
  11. DWORD dwError = 0;
  12. if ( g_hMyDll == NULL)
  13. g_hMyDll = LoadLibrary(_T("Renderings.dll"));
  14. if ( g_hMyDll == NULL)
  15. {
  16. dwError = GetLastError();
  17. AfxMessageBox(_T("加载动态库失败"));
  18. return FALSE;
  19. }
  20. g_pfLoadCustomerJPG = (LOADCUSTOMERJPG)::GetProcAddress(g_hMyDll,"LoadRenderings");
  21. if ( g_pfLoadCustomerJPG == NULL)
  22. {
  23. FreeLibrary(g_hMyDll);
  24. g_hMyDll = NULL;
  25. return FALSE;
  26. }
  27. return TRUE;
  28. }
  29. void FreeTestCaseDll()
  30. {
  31. if ( g_hMyDll )
  32. {
  33. FreeLibrary(g_hMyDll);
  34. g_hMyDll = NULL;
  35. g_pfLoadCustomerJPG = NULL;
  36. }
  37. }