⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timeoutsocket.cpp

📁 Bug管理系统
💻 CPP
字号:
// TimeOutSocket.cpp : implementation file
//

#include "stdafx.h"
#include "TimeOutSocket.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTimeOutSocket

CTimeOutSocket::CTimeOutSocket()
{

}

CTimeOutSocket::~CTimeOutSocket()
{

}

// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CTimeOutSocket, CSocket)
    //{{AFX_MSG_MAP(CTimeOutSocket)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif  // 0

/////////////////////////////////////////////////////////////////////////////
// CTimeOutSocket member functions

BOOL CTimeOutSocket::OnMessagePending()
{
    MSG msg;
    if (::PeekMessage(&msg, NULL, WM_TIMER, WM_TIMER, PM_NOREMOVE)) {
        if (msg.wParam == (UINT) m_nTimerID) {
            // Remove the message and call CancelBlockingCall
            ::PeekMessage(&msg, NULL, WM_TIMER, WM_TIMER, PM_REMOVE);
            CancelBlockingCall();
            return FALSE;  // No need for idle time processing
        }
    }

    return CSocket::OnMessagePending();

}

UINT_PTR CTimeOutSocket::SetTimeOut(UINT uTimeOut)
{
    m_nTimerID = SetTimer(NULL, 0, uTimeOut, NULL);
    return m_nTimerID;

}

BOOL CTimeOutSocket::KillTimeOut()
{
    return KillTimer(NULL, m_nTimerID);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -