Skip to content

Instantly share code, notes, and snippets.

@yangg
Created December 10, 2011 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yangg/1455388 to your computer and use it in GitHub Desktop.
Save yangg/1455388 to your computer and use it in GitHub Desktop.
延时函数(不假死)
using System.Runtime.InteropServices;
[DllImport("kernel32.dll")]
static extern uint GetTickCount();
static void Delay(uint ms) {
uint start = GetTickCount();
while (GetTickCount() - start < ms) {
Application.DoEvents();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment