#include "smt4497-P1.h" int esperaPulseTecla(int toutMs) { int res = 0; int antes = GetTickCount(); int ahora; do { if (_kbhit()) { res = _getch(); break; } if (toutMs > 0) Sleep(1); ahora = GetTickCount(); } while (ahora - antes < toutMs); return res; }