C++ Call DLL

CallDLL.CPP

#include 

#include 

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

你可能感兴趣的:(Cpp)