Originally Posted by ßlindRobe can anyone give me Timer With create Thread in one line please Go, get a C++ book. http://www.mpgh.net/forum/31-c-c-pro...resources.html
[highlight=c++]void SampleFunction() { int x = 300; while(x > 0) { cout << x << endl; x-=1; } } void main() { int SecondsToWait = 5; Sleep(SecondsToWait * 1000); CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) SampleFunction, NULL, 0, NULL); }[/highlight] LOL @Nico ... Do you think he will do it ?
Originally Posted by ßlindRobe @Hassan I Mean Thread Made By Timer Timer(SampleFunction) do u understand me ?? Code: void Timer(LPTHREAD_START_ROUTINE func, int SecondsToWait) { Sleep(SecondsToWait * 1000); CreateThread(NULL, 0, func, NULL, 0, NULL); }
I think he wants to measure execution time of a function: Code: DWORD old = timeGetTime(); // exec function cout<<"execution time:"<<timeGetTime()-old;