wxTimer的用法

6-15 1,192 views

websockserver.h

#include <wx/wx.h>

class WebsockServer final : public wxEvtHandler
{
public:
    WebsockServer();
    virtual ~WebsockServer();

public:
    DECLARE_EVENT_TABLE()
    void OnTimer(wxTimerEvent& event);

private:
    wxTimer m_timerServe;
    wxTimer m_timerReport;
};

websockserver.cpp

#include <wx\wx.h>

BEGIN_EVENT_TABLE(WebsockServer, wxEvtHandler)
EVT_TIMER(XRCID("ID_TIMER_WSS_SERVE"), WebsockServer::OnTimer)
EVT_TIMER(XRCID("ID_TIMER_WSS_REPORT"), WebsockServer::OnTimer)
END_EVENT_TABLE()

WebsockServer::WebsockServer()
    :wxEvtHandler()
{
    m_timerServe.SetOwner(this, XRCID("ID_TIMER_WSS_SERVE"));
    m_timerReport.SetOwner(this, XRCID("ID_TIMER_WSS_REPORT"));
    m_timerServe.Start(1000);
    m_timerReport.Start(500);

    //m_timerServe.Connect(m_timerServe.GetId(), wxEVT_TIMER, wxTimerEventHandler(WebsockServer::OnTimer), NULL, this);
    //m_timerReport.Connect(m_timerReport.GetId(), wxEVT_TIMER, wxTimerEventHandler(WebsockServer::OnTimer), NULL, this);
}

WebsockServer::~WebsockServer()
{

}

void WebsockServer::OnTimer(wxTimerEvent& event)
{
    int id = event.GetId();
    if (id == XRCID("ID_TIMER_WSS_SERVE"))
    {

    }
    else if (id == XRCID("ID_TIMER_WSS_REPORT"))
    {

    }
}

COM in plain C

https://www.codeproject.com/Articles/13601/COM-in-plain-C

阅读全文

A Brief Intro to Input Method Framework, Linux IME, and XIM

https://tedyin.com/posts/a-brief-intro-to-linux-input-method-framework/ There are chances one need an input method editor (IME). For CJK users, su...

阅读全文

使用Visual studio查看exe或DLL文件的依赖项

事先准备:只要 Visual Studio 任何版本即可。 点击开始 -> 程序 -> Visual Studio对应的版本,打开Visual Studio Tools -> 选择 命令提示 进入命...

阅读全文

1 条评论

欢迎留言