本文整理汇总了C++中OnTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ OnTimer函数的具体用法?C++ OnTimer怎么用?C++ OnTimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OnTimer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateData
void CIOCP_ClientDlg::OnBnClickedStopTest()
{
UpdateData(TRUE);
GetDlgItem(IDB_STOP_TEST)->EnableWindow(FALSE);
m_IOCPModel.EndTest();
ClientDB::GetInstance()->ExecuteSQL(TEXT("COMMIT;")); // 提交事务
KillTimer(ID_TIMER_FRESH_INTERVAL);
OnTimer(ID_TIMER_FRESH_INTERVAL);
KillTimer(ID_TIMER_PER_SEC);
OnTimer(ID_TIMER_PER_SEC);
MessageBox(_T("测试已完成!"),_T("提示"), MB_OK);
GetDlgItem(IDB_START_TEST)->EnableWindow(TRUE);
}
示例2: switch
LRESULT RootWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CREATE:
return OnCreate();
case WM_MOUSEMOVE:
return OnMouseMove(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
case WM_NCDESTROY:
KillTimer(m_hwnd, ANIM_TIMER_ID);
// Death of the root window ends the thread
PostQuitMessage(0);
break;
case WM_SETFOCUS:
if (NULL != m_hwndChild)
SetFocus(m_hwndChild);
return 0;
case WM_TIMER:
OnTimer();
return 0;
case WM_KEYDOWN:
OnKeyDown(wParam, lParam);
return 0;
}
return super::HandleMessage(uMsg, wParam, lParam);
}
示例3: return
bool CMixer::Exclusive(bool Enable, const DISPLAY_MODE_INFO *ModeInfo)
{
if (Enable == m_IsExclusive)
return(TRUE); // nothing to do
bool retc = FALSE; // assume failure
if (Enable) {
if (GetCurView() == NULL) // if no view
return(FALSE); // exclusive mode is useless
CString ErrMsg;
if (CreateBackBuf(ErrMsg, ModeInfo)) { // create back buffer
ApplySettings();
OnTimer(FRAME_TIMER_ID); // display first frame
retc = TRUE; // success
} else { // create back buffer failed
DestroyBackBuf();
if (ErrMsg.IsEmpty()) // if specific error message wasn't set
ErrMsg.LoadString(IDS_CANT_SET_EXCLUSIVE); // use generic message
AfxMessageBox(ErrMsg);
}
} else { // disable exclusive
DestroyBackBuf();
retc = TRUE; // success
}
theApp.UpdateAllViews(NULL, CFracticeView::UVH_EXCLUSIVE, NULL);
return(retc);
}
示例4: QGridLayout
OpenGLOutput::OpenGLOutput()
:QDialog()
{
ui = new Ui::OpenGLOutputDialog();
ui->setupUi(this);
layout = new QGridLayout(ui->previewContainer);
layout->setMargin(0);
previewView = new CDeckLinkGLWidget(this);
previewView->resize(ui->previewContainer->size());
previewView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout->addWidget(previewView, 0, 0, 0, 0);
previewView->DrawFrame(NULL);
pOpenGLOutput = new BMDOpenGLOutput();
if (!pOpenGLOutput->InitDeckLink())
exit(0);
if (!pOpenGLOutput->InitGUI(previewView))
exit(0);
if (!pOpenGLOutput->InitOpenGL())
exit(0);
pTimer = new QTimer(this);
connect(pTimer, SIGNAL(timeout()), this, SLOT(OnTimer()));
setWindowTitle("OpenGLOutput");
show();
}
示例5: WndProc
LRESULT WINAPI WndProc( HWND hWnd, UINT nMsg,
WPARAM wParam, LPARAM lParam )
{
switch( nMsg )
{
case WM_PAINT:
OnPaint( hWnd );
break;
case WM_TIMER:
OnTimer( hWnd, wParam );
break;
case WM_CREATE:
{
SetTimer( hWnd, 1, 10, NULL );
// SetTimer( hWnd, 2, 2000, TimerProc );
//最后一个参数是否为NULL,将影响 这个定时器
//触发WM_TIMER消息,找谁处理。
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
}
return DefWindowProc( hWnd, nMsg, wParam, lParam );
}
示例6: StopAnimation
void CFadeButtonUI::DoEvent(TEventUI& event)
{
if( event.Type == UIEVENT_MOUSEENTER && !IsAnimationRunning( FADE_IN_ID ) )
{
m_bFadeAlpha = 0;
m_bMouseHove = TRUE;
StopAnimation( FADE_OUT_ID );
StartAnimation( FADE_ELLAPSE, FADE_FRAME_COUNT, FADE_IN_ID );
Invalidate();
return;
}
if( event.Type == UIEVENT_MOUSELEAVE && !IsAnimationRunning( FADE_OUT_ID ) )
{
m_bFadeAlpha = 0;
m_bMouseLeave = TRUE;
StopAnimation(FADE_IN_ID);
StartAnimation(FADE_ELLAPSE, FADE_FRAME_COUNT, FADE_OUT_ID);
Invalidate();
return;
}
if( event.Type == UIEVENT_TIMER )
{
OnTimer( event.wParam );
}
CButtonUI::DoEvent( event );
}
示例7: LogInfo
Cron::Cron() {
LogInfo("Cron Started...");
// Conmpute next slot
int now = QDateTime::currentDateTime().toTime_t();
QTimer::singleShot(1000 * (60 - (now%60)), this, SLOT(OnTimer()));
lastGivenID = 0;
}
示例8: Initialize
void CSnakeView::OnStart()
{
// TODO: 在此添加命令处理程序代码
gameStart = 1;
Initialize();
OnTimer(1);
}
示例9: switch
int CMainFrame::MsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
OnCommand(wParam, lParam);
break;
case WM_CREATE:
OnCreate(wParam, lParam);
break;
case WM_DESTROY:
OnDestroy(wParam, lParam);
break;
case WM_SIZE:
OnSize(wParam, lParam);
return 1;
case WM_TIMER:
OnTimer(wParam, lParam);
return 1;
case WM_ERASEBKGND:
return 0;
}
return DefFrameProc(m_hWnd, m_hClient, uMsg, wParam, lParam);
}
示例10: ASSERT
LRESULT CTrayIconHooker::WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{
ASSERT(m_pTrayIcon);
LRESULT lResult = 0;
if (nMsg == wm_TaskbarCreated)
lResult = OnTaskbarCreated(wParam, lParam);
else
{
switch (nMsg)
{
case WM_TIMER:
{
if (wParam == m_pTrayIcon->m_NotifyIconData.uID) //It's our timer
OnTimer(wParam);
else
lResult = Default();
break;
}
default:
{
lResult = Default();
break;
}
}
}
return lResult;
}
示例11: ScreenSaverProc
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
InitSaver(hWnd);
break;
case WM_TIMER:
OnTimer(hWnd, (UINT)wParam);
break;
case WM_DESTROY:
KillTimer(hWnd, IDT_TIMER);
PostQuitMessage(0);
return 0;
case WM_KEYDOWN:
#ifdef DEBUG_MODE // in debug mode, user can exit program by press "ESC"
if(VK_ESCAPE == wParam)
PostQuitMessage(0);
#endif
if(IsMagicKey((char)wParam))
return 0;
break;
}
#ifndef DEBUG_MODE
return DefScreenSaverProc(hWnd, message, wParam, lParam);
#else
return DefWindowProc(hWnd, message, wParam, lParam);
#endif
}
示例12: dc
void CComboBoxExt::OnCbnSelendCandel()
{
CClientDC dc(this);
m_bPress=FALSE;
dc.DeleteDC();
OnTimer(1001);
}
示例13: switch
void App::OnKeyboard(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
switch (message) {
case WM_KEYUP:
break;
case WM_KEYDOWN:
break;
case WM_CHAR: {
switch (wParam) {
case 'k':
KillHalf(hwnd);
break;
case 'x':
PostQuitMessage(0);
break;
// Temporary thing to fasten the program
case ' ':
OnTimer(hwnd);
break;
}
}
break;
default:
break;
}
}
示例14: main
int main(int argc,char ** argv)
{
// start GL context and O/S window using the GLFW helper library
appDelegate.AppWillStart();
FPS_Helper fpsHelper;
fpsHelper.SetFixedFPS(30);
InitOpenGL();
appDelegate.AppDidStart();
while (!glfwWindowShouldClose (mainWnd.window))
{
// wipe the drawing surface clear
static double timer_last = 0;
double curr_time = glfwGetTime();
if(curr_time - timer_last > 0.2)
{
timer_last = timer_last + 0.02;
OnTimer();
}
if(fpsHelper.Tick())
{
OnRender();
// update other events like input handling
glfwPollEvents ();
// put the stuff we've been drawing onto the display
glfwSwapBuffers (mainWnd.window);
}
}
// close GL context and any other GLFW resources
appDelegate.AppWillTerminate();
glfwTerminate();
return 0;
}
示例15: GetHandle
void CEditLog::AddText(
LPCWSTR pwszAdd,
bool bLFtoCRLF // = false
)
{
if( pwszAdd ) {
::EnterCriticalSection( &m_csLock );
if( bLFtoCRLF ) {
// Add text to our buffer, but convert each LF to a CRLF pair
int cchAdd = ::wcslen( pwszAdd );
// Ensure no buffer enlargement operations are necessary
m_wsStore.reserve( m_wsStore.length() + cchAdd * 2 );
for( int i = 0; i < cchAdd; ++i ) {
if( pwszAdd[ i ] == L'\n' )
m_wsStore += L'\r';
m_wsStore += pwszAdd[ i ];
}
}
else
// Simly add text
m_wsStore += pwszAdd;
// If the log is filled really fast or the UI thread is doing something
// else, the WM_ADDTEXT messages may not get processed for a long period.
// To avoid floating the UI threads message queue, we post only one message.
if( !m_bMessagePending && GetHandle() != NULL ) {
::PostMessage( GetHandle(), WM_ADDTEXT, 0, 0 );
m_bMessagePending = true;
}
::LeaveCriticalSection( &m_csLock );
}
OnTimer(0);
}