//启动com库
WSADATA Data_WSA;
int nWSAStartup = WSAStartup(MAKEWORD(1, 1), &Data_WSA);
if( nWSAStartup != 0 )
{
return;
}
//加载动态链接库
AnsiString str= strPath + (AnsiString)"\\Net.dll";
HINSTANCE handle = LoadLibrary(str.c_str());
if (handle == NULL)
{
return;
}
//打开网口
FARPROC lpFarProc;
lpFarProc = GetProcAddress(handle,"OpenNet");
long (*OpenNet)(char*,long);
OpenNet = (long (__cdecl*)(char*,long))lpFarProc;
long lSuccess = OpenNet("192.168.0.1", 8080);
if (lSuccess != 0)
{
FreeLibrary(handle);
return;
}
//释放动态链接库
FreeLibrary(handle);
时间: 2024-11-05 18:47:15