C++ Call DLL

CallDLL.CPP

#include <windows.h>

#include <iostream>

using namespace std;

 

typedef int (*AddFunc)(char* pSystemInfo, int& nLen);

char* path="v6.3.19_T1_20200423_winApi/20200423_clientdll64_windows/WinDataCollect.dll";

LPCTSTR widepath = (LPCTSTR)path;

int main(int argc, char *argv[])

{

     HMODULE hDll = LoadLibrary(widepath);

    char pSystemInfo[]="";

    int result=0;

    int nlen=300;

     if (hDll != NULL)

     {

          AddFunc CTP_GetSystemInfo = (AddFunc)GetProcAddress(hDll, "CTP_GetSystemInfo");

          if (CTP_GetSystemInfo != NULL)

          {

               result=CTP_GetSystemInfo(pSystemInfo,nlen);

               

          }

          FreeLibrary(hDll);

          cout << "The result is " << result;

          cout << "pSystemInfo is " <&l

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章