Advertisement
2002C System Services/ Functions #15913

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

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

AI

AI 摘要: 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.

源代码
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;
}
原始评论 (3)
从 Wayback Machine 恢复