本文整理汇总了C++中session::close方法的典型用法代码示例。如果您正苦于以下问题:C++ session::close方法的具体用法?C++ session::close怎么用?C++ session::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session
的用法示例。
在下文中一共展示了session::close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
result = server.init();
packet_c.init(&server);
if (result == 0)
{
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
gTimerStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
gTimerDoneEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
hTimerQueue = CreateTimerQueue();
result = CoInitialize(NULL);
if (result == 0)
{
result = app.init();
if (result == 0)
{
CreateTimerQueueTimer(&hTimer, hTimerQueue, (WAITORTIMERCALLBACK)Update, NULL, 60, DPF, 0);
MSG winmsg;
while (result == 0)
{
result = server.receive();
WaitForSingleObject(gTimerDoneEvent, DPF);
if (GetMessage(&winmsg, NULL, 0, 0))
{
TranslateMessage(&winmsg);
DispatchMessage(&winmsg);
}
}
SetEvent(gTimerStopEvent);
WaitForSingleObject(gTimerDoneEvent, 1000);
if (result > 1)
{
string error = "Runtime error:\n";
switch (result)
{
case 2:
error.append("You have been disconnected.");
break;
}
MessageBox(NULL, error.c_str(), NULL, MB_OK);
}
}
else
{
MessageBox(NULL, (LPCSTR)"Failed to initialize windows app.", NULL, MB_OK);
}
CoUninitialize();
}
server.close();
}
else
{
string error = "Connection failure:\n";
switch (result)
{
case 1:
error.append("Could not connect to server.");
break;
case 2:
error.append("Incorrect handshake packet.");
break;
}
MessageBox(NULL, error.c_str(), NULL, MB_OK);
}
return 0;
}