Click here to Skip to main content
15,901,001 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: what is the difference between "static" function and "inline" function? Pin
SoMad12-May-13 18:29
professionalSoMad12-May-13 18:29 
GeneralRe: what is the difference between "static" function and "inline" function? Pin
yu-jian14-May-13 4:13
yu-jian14-May-13 4:13 
AnswerRe: what is the difference between "static" function and "inline" function? Pin
pasztorpisti12-May-13 21:58
pasztorpisti12-May-13 21:58 
QuestionCHtmlEditCtrl - Overriding printer dialog and use with modeless dialogs Pin
Member 822518012-May-13 4:31
Member 822518012-May-13 4:31 
QuestionHow to set up a computer for network programming on UNIX [SOLVED] Pin
noislude11-May-13 13:44
noislude11-May-13 13:44 
AnswerRe: How to set up a computer for network programming on UNIX Pin
Richard MacCutchan11-May-13 21:24
mveRichard MacCutchan11-May-13 21:24 
GeneralRe: How to set up a computer for network programming on UNIX Pin
noislude12-May-13 3:43
noislude12-May-13 3:43 
GeneralRe: How to set up a computer for network programming on UNIX Pin
Richard MacCutchan12-May-13 3:58
mveRichard MacCutchan12-May-13 3:58 
GeneralRe: How to set up a computer for network programming on UNIX Pin
noislude12-May-13 4:09
noislude12-May-13 4:09 
GeneralRe: How to set up a computer for network programming on UNIX Pin
Richard MacCutchan12-May-13 4:15
mveRichard MacCutchan12-May-13 4:15 
GeneralRe: How to set up a computer for network programming on UNIX Pin
dusty_dex12-May-13 5:02
dusty_dex12-May-13 5:02 
GeneralRe: How to set up a computer for network programming on UNIX Pin
noislude12-May-13 8:54
noislude12-May-13 8:54 
QuestionStrange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH11-May-13 10:02
OmarSH11-May-13 10:02 
AnswerRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
dusty_dex11-May-13 10:23
dusty_dex11-May-13 10:23 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH11-May-13 11:06
OmarSH11-May-13 11:06 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
dusty_dex11-May-13 12:51
dusty_dex11-May-13 12:51 
AnswerRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
Richard MacCutchan11-May-13 21:22
mveRichard MacCutchan11-May-13 21:22 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH12-May-13 3:09
OmarSH12-May-13 3:09 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
Richard MacCutchan12-May-13 3:26
mveRichard MacCutchan12-May-13 3:26 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH12-May-13 3:38
OmarSH12-May-13 3:38 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
Richard MacCutchan12-May-13 3:54
mveRichard MacCutchan12-May-13 3:54 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH12-May-13 4:11
OmarSH12-May-13 4:11 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
Richard MacCutchan12-May-13 4:17
mveRichard MacCutchan12-May-13 4:17 
QuestionRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
David Crow13-May-13 4:53
David Crow13-May-13 4:53 
QuestionMicrosecond Timer Pin
Stephane3410-May-13 10:24
Stephane3410-May-13 10:24 
Hi all,

I ask me of myzelf what kind of Timers APi can I use for create an delays of microseconds?

I read the MSDN site and I found the topics of different manners for create function that generates an delay of microseconds.

Witch one is the best solution for my problem if the user set the delay in microseconds and the function executes the adjustable microseconds of the user.

I hope that here developers knowledge the WinAPI and low level programming. I work under Windows XP/7

We have the chooice of:

1 Multimedia Timer
2. Waitable Timer
3. Queue Timer

1) Whitch is the best chooice of this timers?
2) How can I rewrite the code for use in microseconds?
3) I wish to change in the exists functions (see above) for programming the functions that using the microsecond
(delay) timer. I don't know how I can change this in the code:

DECLARE SUB TimeInit_us()
DECLARE FUNCTION TimeRead_us() AS QUAD
DECLARE SUB Delay_us(BYVAL wDelay AS WORD)

'------------------------------------------------------------------------------
' TIME functions
'------------------------------------------------------------------------------
' This set of functions is important for various time measurements. Just as
' with DELAY function (in ms) and Delay_us (in µs), TIME functions also operate on millisecond or
' microsecond basis.
' TIMEINIT (in ms) and TIMEINIT_US (in µs) will reset the timers to zero and start them again
' with ms or us precision
' TIMEREAD (in ms) and TIMEREAD_US (in µs) functions will read the amount of time (in ms or us)
' since the last TIMEINIT or TIMEINITUS function was executed. Both functions
' return a 64-bit integer

4) How can I combine it to an Quad word (64 bit)?

[code]

#Dim All
#Include "Win32API.inc"

Type LARGE_INTEGER
low_part As Long
high_part As Long
End Type

Global g_TimeUnit As Double
Global g_Start_Time_Low As Long
Global g_Start_Time_High As Long

'========================================================================='
'Milliseconds Delay Timer Functions '
'========================================================================='

Sub TimeInit()
'==============================================='
'Reset the milliseconds Timer to Zero
'will reset the timers to zero and start them again with ms precision
'===============================================
Local f As LARGE_INTEGER
Local t As LARGE_INTEGER
Local x As Dword

x = QueryPerformanceFrequency(f)
g_TimeUnit = 1000 / f.low_part
x = QueryPerformanceCounter(t)

g_Start_Time_Low = t.low_part
g_Start_Time_High = t.high_part
End Sub

Function TimeRead() As QUAD
'=======================================
' TIMEREAD functions will read the amount of time (in ms)
' since the last TIMEINIT function was executed. The function
' return a 64-bit integer
'=======================================
Local t As LARGE_INTEGER
Local x As Dword

If(g_TimeUnit = 0) Then g_TimeUnit = 0.000838096515
x = QueryPerformanceCounter(t)
Function = (t.high_part * 4294967296# + t.low_part - g_Start_Time_High * 4294967296# - g_Start_Time_Low * g_TimeUnit)
End Function

Sub Delay(ByVal wDelay_time As Word)
'=============================================
'With the DELAY function is important for various time measurements. Just
'as with Delay function, Time function also operate on ms basic
'=============================================
Local time_start As Double

time_start = TimeRead()
While(TimeRead() < (time_start + wDelay_time)) : Wend
End Sub
[/code]

I hope that here someone help me but I can't written the functions for the microseconds timer

Kind regards
Stephane

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.