DONSEE东信智能 - 身份证社保卡读卡智能终端应用服务商

eastcoms@qq.com
400-6722-705
首页 > 服务支持专区 > 产品支持 > 常见问题

C++动态加载donsee32.dll方法

来源:www.eastcoms.com   标签:C++ 动态调用   发布时间: 2024-8-16 16:51:22

广东东信智能科技有限公司EST免驱系列产品

C++动态加载donsee32.dll方法,不依赖于donsee32.h和donsee32.lib文件。


void CtestDemoDlg::OnBnClickedButton4()

{

    HINSTANCE g_hCtrlInstance;

    g_hCtrlInstance = LoadLibrary("donsee32.dll"); //加载dll

    if (!g_hCtrlInstance)

    {

    FreeLibrary(g_hCtrlInstance);

    ShowInfo("加载donsee32.dll失败!");

    return;

    }


    typedef long(_stdcall* fpDonsee_Open)(char*);//宏定义函数指针类型,输出接口,定义函数指针

    fpDonsee_Open Donsee_Open = (fpDonsee_Open)GetProcAddress(g_hCtrlInstance, "Donsee_Open");//函数指针声明,声明变量


    typedef long(_stdcall* fpDonsee_Beep)();//蜂鸣

    fpDonsee_Beep Donsee_Beep = (fpDonsee_Beep)GetProcAddress(g_hCtrlInstance, "Donsee_Beep");


    typedef long(_stdcall* fpDonsee_ReadIDCard)(int, char*, IDINFO*, char*);//读身份证

    fpDonsee_ReadIDCard Donsee_ReadIDCard = (fpDonsee_ReadIDCard)GetProcAddress(g_hCtrlInstance, "Donsee_ReadIDCard");


    if (Donsee_Open == NULL || Donsee_Beep == NULL || Donsee_ReadIDCard==NULL)

    {

    ShowInfo("加载Dll函数失败!");

    FreeLibrary(g_hCtrlInstance);

    return;

    }

    long t_nRe;

    t_nRe = Donsee_Open("USB");

    if (t_nRe != 0)

    {

    FreeLibrary(g_hCtrlInstance);

    ShowInfo("打开读卡器失败!");

    return;

    }

//读身份证

    char t_arrMsg[256];

    char t_szPicPath[256] = "IDphoto.jpg";

    CString t_strTemp;

    IDINFO idInfo;

    memset(&idInfo, 0, sizeof(IDINFO));

    t_nRe = Donsee_ReadIDCard(1, t_szPicPath, &idInfo, t_arrMsg);

    if (t_nRe != 0)

    {

    FreeLibrary(g_hCtrlInstance);

    ShowInfo("身份证读取失败");

    return;

    }

    Donsee_Beep();

    ShowInfo("身份证读取成功:");

    ShowInfo("证件类型标识:", idInfo.certType);

    ShowInfo("姓名:", idInfo.name);

    ShowInfo("性别:", idInfo.sex);

    ShowInfo("证件号码:", idInfo.number);

    ShowInfo("出生日期:", idInfo.birthday);

    FreeLibrary(g_hCtrlInstance);

}


 

 
QQ在线咨询