Click here to Skip to main content
15,929,263 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Thread suspend and timer Pin
Tim Smith23-Mar-02 17:13
Tim Smith23-Mar-02 17:13 
GeneralRe: Thread suspend and timer Pin
Paul M Watt23-Mar-02 17:27
mentorPaul M Watt23-Mar-02 17:27 
GeneralVC++.NET OLE DB - How to Save Problems Pin
23-Mar-02 13:56
suss23-Mar-02 13:56 
GeneralHelp getting VCF to compile on VC7 Pin
Jim Crafton23-Mar-02 12:56
Jim Crafton23-Mar-02 12:56 
GeneralChange Menu Pin
joeperris23-Mar-02 10:45
joeperris23-Mar-02 10:45 
GeneralRe: Change Menu Pin
Paul M Watt23-Mar-02 11:18
mentorPaul M Watt23-Mar-02 11:18 
Generaltimer question repost. Pin
23-Mar-02 10:01
suss23-Mar-02 10:01 
GeneralRe: timer question repost. Pin
Paul M Watt23-Mar-02 10:31
mentorPaul M Watt23-Mar-02 10:31 
use QueryPerformanceCounter.

here is an example.

LARGE_INTEGER liFrequency;
LARGE_INTEGER liStart;
LARGE_INTEGER liEnd;

// Get the frequency resolution of your timer.
if (FALSE == QueryPerformanceFrequency (&liFrequency))
{
	MessageBox("Your computer will not support this test.  It does not contain a high resolution timer.", "Error", MB_OK | MB_ICONEXCLAMATION);
	return FALSE;
}

// Get the start reference point
QueryPerformanceCounter(&liStart)

// Perform your code opertions, or the user pauses or whatever ...
...

// Get the current or end reference point
QueryPerformanceCounter(&liEnd)

// Calculate the length in time between the two points.
LARGE_INTEGER liDiff;

double dTime;

liDiff.LowPart = liEnd.LowPart - liStart.LowPart;
// most likely you will only need to worry about the lowpart.
liDiff.HighPart = liEnd.HighPart - liStart.HighPart;

// Scale down the clock ticks to units of time.
dTime = (double)liDiff.LowPart / (double)liFrequency.LowPart;


I cannot remember what units dTime is in at this point, but if you test it in your debugger you should be able to figure it out. Then use dTime to test if it has been the second that you are looking for.
GeneralThank you so much...... Pin
23-Mar-02 10:56
suss23-Mar-02 10:56 
GeneralRe: timer question repost. Pin
Christopher Duncan24-Mar-02 14:15
Christopher Duncan24-Mar-02 14:15 
GeneralLittle InterNet Explorer Problem... and reg Pin
FireStorm23-Mar-02 9:32
FireStorm23-Mar-02 9:32 
QuestionHow to lcok GridCellCombo Pin
23-Mar-02 9:31
suss23-Mar-02 9:31 
AnswerRe: How to lcok GridCellCombo Pin
Matt Newman23-Mar-02 9:32
Matt Newman23-Mar-02 9:32 
AnswerRe: How to lcok GridCellCombo Pin
thibodaux2-Apr-02 4:45
thibodaux2-Apr-02 4:45 
QuestionWhat to make timer? Pin
23-Mar-02 8:48
suss23-Mar-02 8:48 
AnswerRe: What to make timer? Pin
Mazdak23-Mar-02 9:01
Mazdak23-Mar-02 9:01 
GeneralRe: What to make timer? Pin
23-Mar-02 8:59
suss23-Mar-02 8:59 
GeneralRe: What to make timer? Pin
Mazdak23-Mar-02 9:10
Mazdak23-Mar-02 9:10 
AnswerRe: What to make timer? Pin
Mazdak23-Mar-02 9:03
Mazdak23-Mar-02 9:03 
GeneralRe: What to make timer? Pin
23-Mar-02 9:33
suss23-Mar-02 9:33 
GeneralRe: What to make timer? Pin
Mazdak23-Mar-02 9:40
Mazdak23-Mar-02 9:40 
AnswerRe: What to make timer? Pin
lilei23-Mar-02 8:59
lilei23-Mar-02 8:59 
GeneralHTML help, Keyword problem ! Pin
Hadi Rezaee23-Mar-02 8:05
Hadi Rezaee23-Mar-02 8:05 
GeneralArray problem Pin
23-Mar-02 7:55
suss23-Mar-02 7:55 
GeneralIt works now...thanks Pin
23-Mar-02 8:03
suss23-Mar-02 8:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.