延迟执行

Sleep()#

1
2
3
4
5
6
7
8
#include <windows.h>

int main() {
    // 单位是毫秒
    Sleep(5000);
    MessageBoxA(NULL, "Hello!", "Success", MB_OK);
    return 0;
}

WaitForSingleObject#

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#include …