-
October 9th, 2004, 12:58 PM
#1
Problem with Sleep() - pls help.
Hi All,
I am using extensive Sleep() function in my application coz i want it to halt at certain point of time. But some people told me that Sleep() is machine dependant as my application doesn't show consistant behavior from machine to machine.
Hence i am trying to use SetTimer() OnTimer() functions to achieve the Sleep() functionality but it ain't happening coz whenever i try to do SetTimer() it executes the OnTimer function independantly as a seperate process and control doesn't stop there.
pls help me how can i achieve the Sleep() functionality without actually using
Sleep() function. Is there any other way we can do the same ?
Thanks in advance.
In
A laptop, internet connection and beer.
-
October 9th, 2004, 06:39 PM
#2
i can't believe it is machine dependant, i think it is OS dependant. if you want it to use for windows, then include windowsx.h. this will allow you to use the sleep function in miliseconds.
for instance:
will wait for 1 second.
hope this helps
-
October 11th, 2004, 11:43 AM
#3
hi lepricaun,
Sleep() func. works without including the header file also, i mean it does not give any compilation errors. So will the performance of Sleep() change if we don't include the windowsx.h header file ?
A laptop, internet connection and beer.
-
October 11th, 2004, 05:02 PM
#4
i don't think it will, but to keep it compatible with other compilers, you should add it
-
October 15th, 2004, 09:54 AM
#5
It is working without the header file also and it did not made any difference even if i included it. I am using VC++ editor.
A laptop, internet connection and beer.
-
October 15th, 2004, 11:45 AM
#6
well, it does make a difference, it is possible that your compiler includes that headerfile by default, but another one might not, thats why it is best to include it anyway.
hope this makes sence to you
-
October 15th, 2004, 05:30 PM
#7
ok i agree with u but how to simulate this Sleep function without using Sleep actually ?
i have tried many things but it seems nothing is working..
just let me know if anybody gets any idea..
Thanks
A laptop, internet connection and beer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|