Can Anybody Help?
I need to get the low level clock ticks for a timing program on the Pocket PC - I am using VB.Net 2005. I have found this article on MSDN:
As you can see it refers to devices in the address and one supposes that it is "what it says on the tin".
However, when placing the example code from this page onto the PPC emulation in Visual Studio (VB) I get the message:
" 'Computer' is not a member of My "
It seems as if Microsoft has an unexplained contradiction in that "My.Computer" is not part of the Compact Framework but is issuing code that includes "My.Computer"
You can get the code from the link but I have dropped it n below...I think the code is for non compact framework and Microsoft have goofed - or I have!
Can anyone suggest anything? I know it can be done as a one time colleague got it working in embedded VB.
Public Sub LoopTask(ByVal secondsToRun As Integer)
Dim startTicks As Integer = My.Computer.Clock.TickCount
Do While IsTimeUp(startTicks, secondsToRun)
' Code to run for at least secondsToRun seconds goes here.
Private Function IsTimeUp( _
ByVal startTicks As Integer, _
ByVal seconds As Integer _
) As Boolean
' This function throws an overflow exception if the
' tick count difference is greater than 2,147,483,647,
' about 24 days for My.Computer.Clock.TickCount.
' Use UInteger to simplify the code for roll over.
Dim uStart As UInteger = _
CUInt(CLng(startTicks) - Integer.MinValue)
Dim uCurrent As UInteger = _
CUInt(CLng(My.Computer.Clock.TickCount) - Integer.MinValue)
' Calculate the tick count difference.
Dim tickCountDifference As UInteger
If uStart <= uCurrent Then
tickCountDifference = uCurrent - uStart
' Tick count rolled over.
tickCountDifference = UInteger.MaxValue - (uStart - uCurrent)
' Convert seconds to milliseconds and compare.
Return CInt(tickCountDifference) < (seconds * 1000)