Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying output at constant intervals

Status
Not open for further replies.

gford2

Technical User
Oct 11, 2000
7
US
I'm trying to write a progam that will display an output every 100 ms. I'm attempting to use the _IntervalTimerInstruction(from the _TimerInstruction class) but i don' tknow where the information on this is found. Vis C++ help is no help. I've also tried using SetTimer and processing the messages in WM_TIMER, but to no avail. Please help
 
> but i don' tknow where the information on this is found.

The main place for information regarding Windows development is the Microsoft Developer Network (MSDN). If you do not have a subscription, you probably should, there is an online version at
Here is an excerpt of the SDK for _IntervalTimerInstruction:

The __IntervalTimerInstruction system class is used to generate events at intervals, much like a WM_TIMER message in Microsoft Windows programming. An event consumer registers to receive interval timer events by creating an event query that references this class. Due to operating system behavior, there are no guarantees that events will be delivered at precisely the requested interval

Good luck
-pete
 
Even in attempting to use WM_TIMER, I am having problems. I am a Biomedical Engineer and programming is not strongpoint. I just started using Vis C++ in September, so therefore source code examples really help.
 
This code clip contains two timers, both from winmm.h, they are high performance and standard (incase high performance isn't available).

// is there a performance counter available?

if (QueryPerformanceFrequency((LARGE_INTEGER *) &perf_cnt)) {

// yes, set time_count and timer choice flag

perf_flag=TRUE;
time_count=(long) perf_cnt/60;
QueryPerformanceCounter((LARGE_INTEGER *) &next_time);
time_scale=1.0/perf_cnt;

} else {

// no performance counter, read in using timeGetTime

next_time=timeGetTime();
time_scale=0.001;
}

// save time of last frame

last_time=next_time;

// run till completed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top