Advertisement
5_2007-2008 System Services/ Functions #174697

A "Delay()" function for c++ windows applications

This code stops your program in windows without causing it to "hang"

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
void Delay(DWORD nTimeMs)
{
	MSG msg;
	DWORD endTick;
	endTick = GetTickCount() + nTimeMs;
	while(GetTickCount() < endTick)
	{
		if(PeekMessage(&msg, NULL, 0, 0, TRUE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	return;
}
Original Comments (3)
Recovered from Wayback Machine