Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create timer in WinApi (C++)?

Tags:

c++

timer

winapi

How to create timer in WinApi (C++)?

like image 674
SomeUser Avatar asked Jan 24 '10 20:01

SomeUser


People also ask

What is WinAPI in C?

WinAPI (also known as Win32; officially called the Microsoft Windows API) is an application programming interface written in C by Microsoft to allow access to Windows features. The main components of the WinAPI are: WinBase: The kernel functions, CreateFile, CreateProcess, etc.

Is there a timer in C++?

The timer() function in C++ returns the updated time as an object of the “time_t” type. The header file where this timer() function is defined is “ctime”.


1 Answers

call the setTimer() Function. Suppose I called

SetTimer(hWnd,POST_CBIT_TIMER,500,NULL);

Call back function is

UINT nIdEvent ;//global member variable

case WM_TIMER:

if(nIDEvent == POST_CBIT_TIMER)
{

KillTimer(hParent,POST_CBIT_TIMER);


}
break;
like image 52
sankar Avatar answered Sep 24 '22 20:09

sankar