"Global hotkey" Need help :)

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 9
Reputation: Fragmad is an unknown quantity at this point 
Solved Threads: 0
Fragmad Fragmad is offline Offline
Newbie Poster

"Global hotkey" Need help :)

 
0
  #1
Aug 30th, 2008
Hello all. I'm pretty new to C++ but not a total beginner. I have done a little program which basicly is a Timer. It's a clock that starts at zero and counts to 4min 45sec, then it playes a sound and restarts.

I want to add a feature which restarts the clock if the user presses the Enter key.

Here's the code (it's not very well organized but doesn't matter in such a small code):
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int kuk=1;
  9. int kuk2=1;
  10. int min;
  11. int sec;
  12. bool reset;
  13.  
  14. while (kuk2 <= 2){
  15. sec=0;
  16. min=0;
  17. reset=false;
  18.  
  19. while (kuk <= 2){
  20. PlaySound("alarm.wav",NULL,SND_ASYNC|SND_FILENAME);
  21. Sleep(1000);
  22. kuk++;
  23. }
  24.  
  25. while (reset == false){
  26. system("CLS");
  27. cout << min << ":" << sec;
  28. sec++;
  29. Sleep(1000);
  30.  
  31. if (sec >= 60){
  32. min++;
  33. sec=00;
  34. }
  35. if (min == 4 && sec == 45){
  36. reset=true;
  37. }
  38.  
  39. }
  40.  
  41. }
  42.  
  43. return 0;
  44. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC