home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / slbeep.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  1KB  |  64 lines

  1. /***
  2. *slbeep.c - Sleep and beep
  3. *
  4. *       Copyright (c) 1991-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines _sleep() and _beep()
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <oscalls.h>
  13. #include <stdlib.h>
  14.  
  15. /***
  16. *void _sleep(duration) - Length of sleep
  17. *
  18. *Purpose:
  19. *
  20. *Entry:
  21. *       unsigned long duration - length of sleep in milliseconds or
  22. *       one of the following special values:
  23. *
  24. *           _SLEEP_MINIMUM - Sends a yield message without any delay
  25. *           _SLEEP_FOREVER - Never return
  26. *
  27. *Exit:
  28. *       None
  29. *
  30. *Exceptions:
  31. *
  32. *******************************************************************************/
  33.  
  34. void __cdecl _sleep(unsigned long dwDuration)
  35. {
  36.  
  37.     if (dwDuration == 0) {
  38.         dwDuration++;
  39.     }
  40.     Sleep(dwDuration);
  41.  
  42. }
  43.  
  44. /***
  45. *void _beep(frequency, duration) - Length of sleep
  46. *
  47. *Purpose:
  48. *
  49. *Entry:
  50. *       unsigned frequency - frequency in hertz
  51. *       unsigned duration - length of beep in milliseconds
  52. *
  53. *Exit:
  54. *       None
  55. *
  56. *Exceptions:
  57. *
  58. *******************************************************************************/
  59.  
  60. void __cdecl _beep(unsigned dwFrequency, unsigned dwDuration)
  61. {
  62.     Beep(dwFrequency, dwDuration);
  63. }
  64.