- 파일명 : GetTickCount_Test.cpp
- 컴파일 : g++ -Wall -o GetTickCount_Test.exe GetTickCount_Test.cpp
windows.h 에는 Sleep 라는 함수가 있습니다.
#include <windows.h>
#include <iostream>
using namespace std;
void sleep(int iMilliseconds)
{
int iStart = GetTickCount();
while ((int)(GetTickCount() - iStart) < iMilliseconds){}
}
int main()
{
int iStart;
int iEnd;
iStart = GetTickCount();
sleep(1000);
iEnd = GetTickCount();
cout << iEnd - iStart << endl;
return 0;
}
'Test Code > C++' 카테고리의 다른 글
WinApi - 사용중인 프로세스 조회 (0) | 2013.12.21 |
---|---|
Mingw - Split 함수 만들기 (0) | 2013.12.21 |
WinAPI - 윈도우폼에 아이콘 넣기 (0) | 2013.12.20 |
WinAPI - SYSTEMTIME (0) | 2013.12.20 |
MingW - DLL 생성 및 사용 (0) | 2013.12.20 |