|
-
Feb 16th, 2006, 06:22 PM
#1
Thread Starter
Junior Member
Mobile time issues
Hello,
I have two questions. 1st How can I lockdown the time on a PDA. I'm running an app that keeps track of instances of use and if I can lock down the time I can be sure of my results.
2nd question. IS it possible to write an application to update the time on the lockdown PDA from a timeserver on the internet?
-
Feb 21st, 2006, 05:32 AM
#2
Fanatic Member
Re: Mobile time issues
1.
I dont think there is any way to lock down the time as such. But what you can do is locking down you application so the user cannot exit it or access other functions/areas of the device. This can be done by disableing the taskbar and startmenu in your application.
2.
In regards to updating the time. You can update the time and date on the device by using code. If you want you can write your own web service that the device will call and it will return the current date/time to the device. Their maybe other ways of doing it like goin to the world time server page/ parsing it and extracting the time from it (but that's a lot more hassle, than using your own published web service on the internet).
Here is the class for updating the time/date below
VB Code:
Imports System.Runtime.InteropServices
Public Class DeviceDateTime
Public Sub New()
End Sub
'System time structure used to pass to P/Invoke...
<StructLayoutAttribute(LayoutKind.Sequential)> _
Private Structure SYSTEMTIME
Public year As Short
Public month As Short
Public dayOfWeek As Short
Public day As Short
Public hour As Short
Public minute As Short
Public second As Short
Public milliseconds As Short
End Structure
'P/Invoke dec for setting the system time...
<DllImport("coredll.dll")> _
Private Shared Function SetLocalTime(ByRef time As SYSTEMTIME) As Boolean
End Function
Public Function SetDeviceTime(ByVal p_NewDate As Date)
'Populate structure...
'Substitute <YOUR DATE OBJECT> with your date object returned via GPRS...
Dim st As SYSTEMTIME
st.year = p_NewDate.Year
st.month = p_NewDate.Month
st.dayOfWeek = p_NewDate.DayOfWeek
st.day = p_NewDate.Day
st.hour = p_NewDate.Hour
st.minute = p_NewDate.Minute
st.second = p_NewDate.Second
st.milliseconds = p_NewDate.Millisecond
'Set the new time...
SetLocalTime(st)
End Function
End Class
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|