#include #include #include #define TACCESS_API __declspec(dllimport) typedef bool (WINAPI *tcallback)(BYTE* pData); typedef BYTE* (WINAPI *typeSendCommand)(BYTE* pData); typedef bool (WINAPI *typeFreeMemory)(BYTE* pData); typedef bool (WINAPI *typeSetCallback)(tcallback pCallback); std::ofstream xmlfile; typeFreeMemory FreeMemory; bool CALLBACK acceptor(BYTE *pData) { xmlfile<"; xmlfile<<""; HMODULE hm = LoadLibrary("Debug\\txmlconnector.dll"); if (hm) { typeSetCallback SetCallback = reinterpret_cast(GetProcAddress(hm, "SetCallback")); FreeMemory = reinterpret_cast(GetProcAddress(hm, "FreeMemory")); SetCallback(acceptor); typeSendCommand SendCommand = reinterpret_cast(GetProcAddress(hm,"SendCommand")); if (!SendCommand) { printf("\"SendCommand\" not found (0x%X)\n", GetLastError()); return -1; } else { BYTE* ss = SendCommand(reinterpret_cast( "" "KOKSkoks" "192.168.15.153901" ".\\LOGS\\0")); std::cout<(ss); FreeMemory(ss); Sleep(10000); ss = SendCommand(reinterpret_cast("" "304" //идентификаторы взял просто для примера "304" //в реально кода надо ориентировать на то, "304" //что присылвает сервер "")); std::cout<(ss); FreeMemory(ss); Sleep(1000); ss = SendCommand(reinterpret_cast( "")); std::cout<(ss); FreeMemory(ss); } try { FreeLibrary(hm); } catch (...) { std::cout<<"Fail in FreeLibrary"; } } int err = GetLastError(); xmlfile<<""; std::cout<<"\nEnded...\n"; char c; std::cin>>c; return 0; }