mirror of
https://github.com/Cc28256/CcRemote.git
synced 2025-07-30 22:16:49 +00:00
添加了test工程,加载dll与控制端进行通信,解决了一些bug
This commit is contained in:
25
CcMainDll/TestLoadDll/TestLoadDll.cpp
Normal file
25
CcMainDll/TestLoadDll/TestLoadDll.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// TestLoadDll.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <Windows.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello World!\n";
|
||||
char strHost[] = "127.0.0.1"; //声明上线地址
|
||||
int nPort = 80; //声明上线端口
|
||||
//载入服务端dll
|
||||
HMODULE hServerDll = LoadLibrary(".\\..\\..\\bin\\server\\CcMainDll.dll");
|
||||
//HMODULE hServerDll = LoadLibrary(".\server.dll");
|
||||
//声明导出函数类型--查看上一节导出的TestRun函数
|
||||
typedef void(_cdecl *TestRunT)(char* strHost, int nPort);
|
||||
//寻找dll中导出函数
|
||||
TestRunT pTestRunT = (TestRunT)GetProcAddress(hServerDll, "TestFun");
|
||||
//判断函数是否为空
|
||||
if (pTestRunT != NULL)
|
||||
{
|
||||
pTestRunT(strHost, nPort); //调用这个函数
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user