Well, You can always make a Thread which is a timer and as soon as the Button is pressed the WM_COMMAND should find the Button ID then using If statement it should call the thread via CreateThread(); then when The other Button is pressed an different thread should start which will terminate the other Thread. Using OpenProcess(); then calling
Well, This is personally what method I would use but there are plenty more methods.
In Real-Time for highly accurate in which I mean till a millionth of a second or so You need to program in the Kernel Level which is quite easy but you have to use only Native Functions and Calls. Kernel Development is a very difficult subject to jump into since you need to understand how a OS works specifically the family of OS such as Windows , Mac , Linux , Unix , Solaris ...
Of course if any Beginner C++ programmer starts programming in the Kernel level there is almost 90 - 98 % chance that they will cause a BSOD (Blue Screen of Death). Or even damage the hardware. Yes... It as happen to me a few week ago.
Back to subject ,
Well there is Forgers WINAPI book which shows how to make a timer. But I personally prefer my method.
Also please stop posting such a generic question since there is around dozen or so methods to do this.