我现在在给程序加密,里面需要checkdog()程序.而这已经写在加密狗里,我现在要做的就是调用狗的dll文件.怎么调用?大家帮帮忙?

解决方案 »

  1.   

    我在setting 里上加了lib文件,在主程序里include 了.h头文件
    可是还出错,error LNK2001: unresolved external symbol _DogCheckDogCheck是dll中的函数
      

  2.   

    试试
    #pragma comment(lib, "lib文件名")
      

  3.   

    哦,那样呀,你用另外的方法试试看,
    声明句柄的方法,
    http://expert.csdn.net/Expert/topic/1094/1094464.xml?temp=.1636621
    LoadLibrary后先申明该函数:
    int (__stdcall * CommOpen)(int);
    然后GetProcAddress得到函数入口,才能调用。
    CommOpen = (int (__stdcall *)(int))GetProcAddress( .., "CommOpen" );int i = CommOpen( 1 );
    或者
    http://expert.csdn.net/Expert/topic/1176/1176869.xml?temp=.7801477//--定义“实例”
     HINSTANCE Dll_handler;//--声明dll内的函数
    typedef BOOL (*DLLTEST)(int nPort, int nBaud, int nByte, int nParity);
    DLLTEST CommOpen;;
    //--装载dll
    Dll_handler = LoadLibrary("Commpro.dll"); CommOpen = (DLLTEST)GetProcAddress(Dll_handler,"CommOpen");//--取得dll中的函数地址
    CommOpen(m_nPort,m_nBaud,m_nByte,m_nParity)
    FreeLibrary(Dll_handler);
      

  4.   

    看看加密狗的手册,可能你没有声明沟中的变量!
    或者某个文件 如 .obj