Results 1 to 2 of 2

Thread: Mobile time issues

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    17

    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?

  2. #2
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    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:
    1. Imports System.Runtime.InteropServices
    2.  
    3. Public Class DeviceDateTime
    4.  
    5.     Public Sub New()
    6.  
    7.     End Sub
    8.  
    9.     'System time structure used to pass to P/Invoke...
    10.     <StructLayoutAttribute(LayoutKind.Sequential)> _
    11.     Private Structure SYSTEMTIME
    12.         Public year As Short
    13.         Public month As Short
    14.         Public dayOfWeek As Short
    15.         Public day As Short
    16.         Public hour As Short
    17.         Public minute As Short
    18.         Public second As Short
    19.         Public milliseconds As Short
    20.     End Structure
    21.  
    22.     'P/Invoke dec for setting the system time...
    23.     <DllImport("coredll.dll")> _
    24.     Private Shared Function SetLocalTime(ByRef time As SYSTEMTIME) As Boolean
    25.  
    26.     End Function
    27.  
    28.     Public Function SetDeviceTime(ByVal p_NewDate As Date)
    29.         'Populate structure...
    30.         'Substitute <YOUR DATE OBJECT> with your date object returned via GPRS...
    31.  
    32.         Dim st As SYSTEMTIME
    33.         st.year = p_NewDate.Year
    34.         st.month = p_NewDate.Month
    35.         st.dayOfWeek = p_NewDate.DayOfWeek
    36.         st.day = p_NewDate.Day
    37.         st.hour = p_NewDate.Hour
    38.         st.minute = p_NewDate.Minute
    39.         st.second = p_NewDate.Second
    40.         st.milliseconds = p_NewDate.Millisecond
    41.  
    42.         'Set the new time...
    43.         SetLocalTime(st)
    44.     End Function
    45. 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
  •  



Click Here to Expand Forum to Full Width