lyfzLoadLibrary.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "StdAfx.h"
  2. #include "lyfzLoadLibrary.h"
  3. namespace lyfzLibrary
  4. {
  5. HMODULE g_hCloudSelectionLib = NULL;
  6. API_uploadorder g_uploadorder = NULL;
  7. API_uploadgoodinfo g_uploadgoodinfo = NULL;
  8. API_uploadimg g_uploadimg = NULL;
  9. API_getcloundresult g_getcloundresult = NULL;
  10. BOOL LoadCloudSelectionLib()
  11. {
  12. if ( g_hCloudSelectionLib == NULL )
  13. g_hCloudSelectionLib = LoadLibrary(_T("lyfzCloudSelection.dll"));
  14. if ( !g_hCloudSelectionLib )
  15. {
  16. AfxMessageBox(_T("打开云链接库失败"));
  17. return FALSE;
  18. }
  19. g_uploadorder = (API_uploadorder)GetProcAddress(g_hCloudSelectionLib, "uploadorder");
  20. if ( g_uploadorder == NULL )
  21. {
  22. AfxMessageBox(_T("获取生成云接口失败"));
  23. return FALSE;
  24. }
  25. g_uploadgoodinfo = (API_uploadgoodinfo)GetProcAddress(g_hCloudSelectionLib, "uploadgoodinfo");
  26. if ( g_uploadgoodinfo == NULL )
  27. {
  28. AfxMessageBox(_T("获取生成云接口失败"));
  29. return FALSE;
  30. }
  31. g_uploadimg = (API_uploadimg)GetProcAddress(g_hCloudSelectionLib, "uploadImg");
  32. if ( g_uploadimg == NULL )
  33. {
  34. AfxMessageBox(_T("获取生成云接口失败"));
  35. return FALSE;
  36. }
  37. g_getcloundresult = (API_getcloundresult)GetProcAddress(g_hCloudSelectionLib, "getresult");
  38. if ( g_getcloundresult == NULL )
  39. {
  40. return FALSE;
  41. }
  42. return TRUE;
  43. }
  44. void FreeCloudSelectionLib()
  45. {
  46. if ( g_hCloudSelectionLib )
  47. FreeLibrary(g_hCloudSelectionLib);
  48. }
  49. };