#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void CALLBACK TimeoutCallback(PTP_CALLBACK_INSTANCE, PVOID pvContext, PTP_TIMER pTimer)
{
long* count = (long*)pvContext;
InterlockedIncrement(count);
cout << GetCurrentThreadId() << "," << *count << 's' << endl;
}
void WaitForKeyboard()
{
while(!_kbhit());
}
void main()
{
PTP_TIMER pTimer = NULL;
long local = 0;
pTimer = CreateThreadpoolTimer(&TimeoutCallback, &local, NULL);
FILETIME ft = {-1, 0};
SetThreadpoolTimer(pTimer, &ft, 100, 0);
WaitForKeyboard();
}