详解MFC/C++调用易语言的整数型和文本型与VS2010互动-创新互联

1、LoadDll.cpp

成都创新互联服务项目包括单县网站建设、单县网站制作、单县网页制作以及单县网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,单县网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到单县省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
#include "StdAfx.h"
#include "LoadDLL.h"

pMFCdll_OneVOID_OneVOID    MFCdll_OneVOID_OneVOID;
pMFCdll_OneWORD_OneVOID    MFCdll_OneWORD_OneVOID;
pMFCdll_OneCHAR_OneVOID    MFCdll_OneCHAR_OneVOID;


pMFCdll_OneWORD_OneWORD    MFCdll_OneWORD_OneWORD;
pMFCdll_OneWORD_TwoWORD    MFCdll_OneWORD_TwoWORD;
pMFCdll_OneWORD_ThreeWORD  MFCdll_OneWORD_ThreeWORD;
pMFCdll_OneWORD_FourWORD  MFCdll_OneWORD_FourWORD;
pMFCdll_OneWORD_FiveWORD  MFCdll_OneWORD_FiveWORD;
pMFCdll_OneWORD_SixWORD    MFCdll_OneWORD_SixWORD;


pMFCdll_OneWORD_OneChar    MFCdll_OneWORD_OneChar;
pMFCdll_OneWORD_TwoChar    MFCdll_OneWORD_TwoChar;
pMFCdll_OneWORD_ThreeChar  MFCdll_OneWORD_ThreeChar;
pMFCdll_OneWORD_FourChar  MFCdll_OneWORD_FourChar;
pMFCdll_OneWORD_FiveChar  MFCdll_OneWORD_FiveChar;
pMFCdll_OneWORD_SixChar    MFCdll_OneWORD_SixChar;


pMFCdll_OneChar_OneChar    MFCdll_OneChar_OneChar;
pMFCdll_OneChar_TwoChar    MFCdll_OneChar_TwoChar;
pMFCdll_OneChar_ThreeChar  MFCdll_OneChar_ThreeChar;
pMFCdll_OneChar_FourChar  MFCdll_OneChar_FourChar;
pMFCdll_OneChar_FiveChar  MFCdll_OneChar_FiveChar;
pMFCdll_OneChar_SixChar    MFCdll_OneChar_SixChar;


pMFCdll_OneChar_OneWORD    MFCdll_OneChar_OneWORD;
pMFCdll_OneChar_TwoWORD    MFCdll_OneChar_TwoWORD;
pMFCdll_OneChar_ThreeWORD  MFCdll_OneChar_ThreeWORD;
pMFCdll_OneChar_FourWORD  MFCdll_OneChar_FourWORD;
pMFCdll_OneChar_FiveWORD  MFCdll_OneChar_FiveWORD;
pMFCdll_OneChar_SixWORD    MFCdll_OneChar_SixWORD;


HINSTANCE  g_Hinstance;  //实例句柄


//加载DLL
BOOL LoadDll(char *name)
{
  
  if(g_Hinstance != NULL) return TRUE;  //如果g_Hinstance不为空就返回

  MFCdll_OneWORD_SixWORD = NULL;  //这里是加载ZJY_SoftOverTime用的
  MFCdll_OneCHAR_OneVOID = NULL;  //这里是加载ZJY_GetSystemDisk用的

  g_Hinstance = LoadLibrary(name);
  if(g_Hinstance == NULL)
  {
//    AfxMessageBox("加载dll动态库失败!");
    return FALSE;
  }

  MFCdll_OneWORD_SixWORD = (pMFCdll_OneWORD_SixWORD)GetProcAddress(g_Hinstance, "ZJY_SoftOverTime");
  MFCdll_OneCHAR_OneVOID = (pMFCdll_OneCHAR_OneVOID)GetProcAddress(g_Hinstance, "ZJY_GetSystemDisk");
  if(NULL == MFCdll_OneWORD_SixWORD || NULL == MFCdll_OneCHAR_OneVOID)
  {
//    AfxMessageBox("加载动态库MFCCallBackDllTest函数失败");
    FreeLibrary(g_Hinstance);
    g_Hinstance = NULL;
    return FALSE;
  }
  return TRUE;
}

//卸载DLL
void UninstallDll()
{
  if (g_Hinstance != NULL)
  {
    MFCdll_OneWORD_SixWORD = NULL;
    MFCdll_OneCHAR_OneVOID = NULL;
    FreeLibrary(g_Hinstance);
    g_Hinstance = NULL;
  }
}

另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享标题:详解MFC/C++调用易语言的整数型和文本型与VS2010互动-创新互联
网页URL:http://ybzwz.com/article/ceeppo.html