MyQProgressDialog::~MyQProgressDialog() { if (m_hUpdateTimer) { DeleteTimerQueueTimer(m_hTimerQueue, m_hUpdateTimer, NULL); m_hUpdateTimer = NULL; } if (m_hTimerQueue) { DeleteTimerQueueEx(m_hTimerQueue, NULL); m_hTimerQueue = NULL; } if (m_hWinHook) { UnhookWindowsHookEx(m_hWinHook); m_hWinHook = NULL; } if (m_hMouseHook) { UnhookWindowsHookEx(m_hMouseHook); m_hMouseHook = NULL; } }
void exitTicker (rtsBool wait) { if (timer_queue != NULL) { DeleteTimerQueueEx(timer_queue, wait ? INVALID_HANDLE_VALUE : NULL); timer_queue = NULL; } }
void vcos_deinit(void) { vcos_assert(inited); _vcos_thread_delete(&main_thread); TlsFree(vcos_thread_data_tls); DeleteTimerQueueEx(timer_queue,INVALID_HANDLE_VALUE); inited = 0; }
GraphicsInterface::~GraphicsInterface() { DeleteTimerQueueEx(_hTimerQueue, INVALID_HANDLE_VALUE); DeleteCriticalSection(&_csCreateDisplay); for (const auto& ge : _ges) { delete ge; } }
static void timer_free(void *timer) { struct timer *t = (struct timer *)timer; HANDLE completion; completion = CreateEvent(NULL, FALSE, FALSE, NULL); DeleteTimerQueueEx(t->queue, completion); WaitForSingleObject(completion, INFINITE); free(t); }
void nglTimer::FreeMainTimer() { if (mTimers.empty()) { DeleteTimerQueueTimer(mTimerQueueHandle, mTimerHandle, NULL); // DeleteTimerQueueEx(mTimerQueueHandle, NULL); while (working) { MSG msg; HWND hwnd = App->GetHWnd(); PeekMessage(&msg, hwnd, WM_NGLTIMER, WM_NGLTIMER, PM_REMOVE); Sleep(2); } DeleteTimerQueueEx(mTimerQueueHandle, INVALID_HANDLE_VALUE); mTimerHandle = NULL; mTimerQueueHandle = NULL; } }
int _tmain(int argc, _TCHAR **argv) { HANDLE hTimerQueue = CreateTimerQueue(); HANDLE hTimer = NULL; DWORD dwDueTimeInMs = 5000; DWORD dwPeriod = 1000; if (NULL == hTimerQueue) { _tperror(_T("Failed to create timer queue.")); return GetLastError(); } if (!CreateTimerQueueTimer(&hTimer, hTimerQueue, TimerRoutine, (PVOID)GetTickCount(), dwDueTimeInMs, dwPeriod, WT_EXECUTEDEFAULT)) { _tperror(_T("Failed to create timer.")); return GetLastError(); } _tprintf(_T("Call timer routine in %lu seconds...\n"), (unsigned long)dwDueTimeInMs / 1000); _tprintf(_T("Hit any key to delete the timer queue and cancel all queued timers!\n")); while (!_kbhit()) { } _getch(); if (!DeleteTimerQueueEx(hTimerQueue, INVALID_HANDLE_VALUE)) { _tprintf(_T("Failed to delete timer queue.\n")); return GetLastError(); } _tprintf(_T("Now I think it is time to say goodbye.\n")); return 0; }
~TimerQ() { if (TimerQueue) DeleteTimerQueueEx(TimerQueue, NULL); };
BOOL DeleteTimerQueue(HANDLE TimerQueue) { return DeleteTimerQueueEx(TimerQueue, NULL); }