Hi,
Basically i need to write a program that will press space every 40 minutes, ive started learning c++ but there appears to be no mention on how to do this in the book i have
Any help greatly appreciated.
Thx in advance.
Hi,
Basically i need to write a program that will press space every 40 minutes, ive started learning c++ but there appears to be no mention on how to do this in the book i have
Any help greatly appreciated.
Thx in advance.
Ke-wha? Press space??? What do you mean? Output a " " (space) to the screen? Every FOURTY MINUTES????? I don't think that I understand what you mean...
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Essentially, i want it to act as if im pressing space every 40 minutes. Surely its more than a case of
cout << " ";
Although i could be wrong.
you need to use a timer of some sort. You can interupt your program flow for forty minutes and cout a space at that interval using an endless loop and any number of built in timers, like system("pause"), or sleep(), or delay(). If you don't want to interupt program flow then you need to get into multithreading, a topic I am aware of, but not competent in.
if you are using windows then
include windows.h.Code:Sleep(1000*60*40); //One thousand Milliseconds(1 sec)times 60(one min)times 40(40 mins) cout << " ";
if you are using anything else then
include dos.h.Code:delay(1000*60*40); cout << " ";
Hmm, you want to simulate a keyboard press every 40 min? So if you happen to be in notepad at that moment, an extra " " will be written..?
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
yes, exactly like that
if this is a windows program you can use SendMessage().
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
its not a windows program, as i say, at this moment in time i know next to nothing, DOS only im afraid