本文整理汇总了C++中OnClose函数的典型用法代码示例。如果您正苦于以下问题:C++ OnClose函数的具体用法?C++ OnClose怎么用?C++ OnClose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OnClose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemovePlayer
void CBattleground::Close()
{
/* remove all players from the battleground */
m_mainLock.Acquire();
m_ended = true;
for(uint32 i = 0; i < 2; ++i)
{
set<Player*>::iterator itr;
set<uint32>::iterator it2;
uint32 guid;
Player* plr;
for(itr = m_players[i].begin(); itr != m_players[i].end();)
{
plr = *itr;
++itr;
RemovePlayer(plr, false);
}
for(it2 = m_pendPlayers[i].begin(); it2 != m_pendPlayers[i].end();)
{
guid = *it2;
++it2;
plr = objmgr.GetPlayer(guid);
if(plr)
RemovePendingPlayer(plr);
else
m_pendPlayers[i].erase(guid);
}
}
/* call the virtual on close for cleanup etc */
OnClose();
/* shut down the map thread. this will delete the battleground from the current context. */
m_mapMgr->SetThreadState(THREADSTATE_TERMINATE);
m_mainLock.Release();
}
示例2: switch
LRESULT CSettingDialog::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lRes = 0;
BOOL bHandled = TRUE;
switch( uMsg ) {
case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
default:
bHandled = FALSE;
}
if( bHandled ) return lRes;
if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
示例3: switch
LRESULT CDuilib3dFrame::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lRes = 0;
BOOL bHandled = TRUE;
switch( uMsg )
{
case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
case WM_USER+1:
{
CControlUI* pControl = (CControlUI*)lParam;
pControl->SetVisible(true);
}break;
default:
bHandled = FALSE;
}
if( bHandled )
{
return lRes;
}
if( m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes) )
{
return lRes;
}
return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
示例4: switch
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lRes = 0;
BOOL bHandled = TRUE;
switch (uMsg)
{
case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
#if defined(WIN32) && !defined(UNDER_CE)
case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
case WM_MOUSEWHEEL: lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
#endif
case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
case WM_CHAR: lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
case WM_KEYDOWN: lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
case WM_KILLFOCUS: lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
case WM_SETFOCUS: lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
case WM_LBUTTONUP: lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break;
case WM_LBUTTONDOWN: lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break;
case WM_MOUSEMOVE: lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break;
case WM_MOUSEHOVER: lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break;
default: bHandled = FALSE; break;
}
if (bHandled) return lRes;
lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled);
if (bHandled) return lRes;
if (m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes))
return lRes;
return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
示例5: while
void dhla::net::TCPSocket::PollEventsSync()
{
while(connected) {
// creating a set of sockets, in order to poll its events
fd_set readset;
FD_ZERO(&readset);
FD_SET(m_fd, &readset); // only one socket for this time
// critical section
MutexLock();
int result = select(0, &readset, NULL, NULL, NULL );
MutexUnlock();
// ends critical section
if(result == 0 || result == SOCKET_ERROR) {
if(OnError) {
OnError(this, "Error waiting for socket's events", WSAGetLastError());
break;
}
else {
throw "Error waiting for socket's events";
}
}
else {
int len = recv(m_fd, m_input_buffer, MAX_BUFFER_SIZE, 0);
if(len < 1) {
if(OnClose && connected) {
connected = false;
OnClose(this);
}
break;
}
if(OnData != NULL) {
OnData(this, m_input_buffer, len);
}
}
}
}
示例6: switch
LRESULT CALLBACK SystemWindow::LocalWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
switch(msg)
{
case WM_SIZE:
OnResize(static_cast<u32>(LOWORD(lparam)), static_cast<u32>(HIWORD(lparam)), static_cast<window::WINDOW_RESIZE_STATE>(wparam));
break;
case WM_MOVE:
OnMove(static_cast<u32>(LOWORD(lparam)), static_cast<u32>(HIWORD(lparam)));
break;
case WM_CLOSE:
OnClose();
break;
case WM_DESTROY:
OnDestroy();
break;
default:
//We don't handle the message so let the Default Window Proc handle it
return DefWindowProcW(hwnd, msg, wparam, lparam);
}
return 0;
}
示例7: OnClose
// Deal with the window messages.
int KUiTaskNote::WndProc(unsigned int uMsg, unsigned int uParam, int nParam)
{
int nResult = false;
if (uMsg == WND_N_BUTTON_CLICK)
{
if (uParam == (unsigned int)(KWndWindow*)&m_BtnClose)
{
OnClose();
nResult = true;
}
else
{
if (uParam == (unsigned int)(KWndWindow*)&m_BtnPersonal)
m_PersonalPad.Show();
nResult = KWndPageSet::WndProc(uMsg, uParam, nParam);
}
}
else
{
nResult = KWndPageSet::WndProc(uMsg, uParam, nParam);
}
return nResult;
}
示例8: CloseHandle
void CIOCPFileAccessor::Close()
{
if(m_FileHandle!=INVALID_HANDLE_VALUE)
{
CloseHandle(m_FileHandle);
m_FileHandle=INVALID_HANDLE_VALUE;
}
InterlockedExchange((LPLONG)&(m_WantClose),FALSE);
COverLappedObject * pOverLappedObject;
while(m_DataQueue.PopFront(pOverLappedObject))
{
GetServer()->DeleteOverLappedObject(pOverLappedObject);
}
while(m_RequestQueue.PopFront(pOverLappedObject))
{
GetServer()->DeleteOverLappedObject(pOverLappedObject);
}
OnClose();
}
示例9: switch
LRESULT CMenuWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lRes = 0;
BOOL bHandled = TRUE;
switch( uMsg )
{
case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
case WM_KILLFOCUS: lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
case WM_KEYDOWN: lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
case WM_MOUSEWHEEL: break;
case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
case WM_MOVE: lRes = OnMove(uMsg, wParam, lParam, bHandled); break;
default:
bHandled = FALSE;
}
if( bHandled ) return lRes;
if( m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
示例10: wxASSERT
void CTransferSocket::TriggerPostponedEvents()
{
wxASSERT(m_bActive);
if (m_postponedReceive)
{
m_pControlSocket->LogMessage(::Debug_Verbose, _T("Executing postponed receive"));
m_postponedReceive = false;
OnReceive();
if (m_transferEndReason != none)
return;
}
if (m_postponedSend)
{
m_pControlSocket->LogMessage(::Debug_Verbose, _T("Executing postponed send"));
m_postponedSend = false;
OnSend();
if (m_transferEndReason != none)
return;
}
if (m_onCloseCalled)
OnClose(0);
}
示例11: main
int main(int _NbrParams, char* _tabstrParams[]) {
// Initialisation...
Init(1024, 768);
dlgNom = new CMSFVTextBox(pSDLRenderer);
dlgTexte = new CMSFVMemo(pSDLRenderer);
mnuContextuel = new CMenu();
// Exécution...
OnShow();
while (Execution());
OnClose();
// Conclusion...
delete mnuContextuel;
delete dlgTexte;
delete dlgNom;
delete pArbreIndSelect;
// delete pRacine;
// delete pCurrent;
return 0;
}
示例12: switch
INT_PTR Dialog::DlgWndProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return OnInitDlg(wParam, lParam);
case WM_COMMAND:
return OnCommand(wParam, lParam);
case WM_NOTIFY:
return OnNotify(wParam, lParam);
case WM_TIMER:
return OnTimer(wParam, lParam);
case WM_CLOSE:
return OnClose(wParam, lParam);
case WM_DESTROY:
return OnDestroy(wParam, lParam);
case WM_SIZE:
return OnSize(wParam, lParam);
case WM_GETMINMAXINFO:
return OnGetMinMaxInfo(wParam, lParam);
}
return (INT_PTR)FALSE;
}
示例13: if
bool CTaskProgressWnd::OnAbortClick()
{
// При нажатии на кнопке "прервать"
if (m_pTask->GetState() == TASK_STATE_WORKING)
{
// если задача выполняется - спросим прерывать ли задачу
if (MessageBox(m_hWindow, FormatC(TEXT("Прервать выполнение задачи \'%s\'?"), m_pTask->GetPTaskInfo()->sName.C()),
MessageCaption, MB_ICONQUESTION | MB_YESNOCANCEL) == IDYES)
{
// если ответили прерывать - прерываем
m_pTask->Abort();
}
}
else if (m_pTask->GetState() == TASK_STATE_NONE)
{
// а если задача не выполняется просто закроем окно
OnClose();
EndDialog(m_hWindow, 0);
m_hWindow = NULL;
}
return true;
}
示例14: assert
void Server::PostRecv(Client* client)
{
assert(client);
WSABUF recvBufferDescriptor;
recvBufferDescriptor.buf = reinterpret_cast<char*>(client->GetRecvBuff());
recvBufferDescriptor.len = Client::MAX_RECV_BUFFER;
DWORD numberOfBytes = 0;
DWORD recvFlags = 0;
IOEvent* event = IOEvent::Create(IOEvent::RECV, client);
assert(event);
StartThreadpoolIo(client->GetTPIO());
if (WSARecv(client->GetSocket(), &recvBufferDescriptor, 1, &numberOfBytes, &recvFlags,
&event->GetOverlapped(), NULL) == SOCKET_ERROR)
{
int error = WSAGetLastError();
if (error != ERROR_IO_PENDING)
{
CancelThreadpoolIo(client->GetTPIO());
ERROR_CODE(error, "WSARecv() failed.");
OnClose(event);
IOEvent::Destroy(event);
}
}
else
{
// In this case, the completion callback will have already been scheduled to be called.
}
}
示例15: switch
void CExternalIPResolver::OnSocketEvent(CSocketEvent& event)
{
if (!m_pSocket)
return;
switch (event.GetType())
{
case CSocketEvent::read:
OnReceive();
break;
case CSocketEvent::connection:
OnConnect(event.GetError());
break;
case CSocketEvent::close:
OnClose();
break;
case CSocketEvent::write:
OnSend();
break;
default:
break;
}
}