|
-
May 11th, 2006, 03:55 PM
#1
Thread Starter
Junior Member
[RESOLVED] Changing time on a PDA.
Hello
I'm new to VS2005 and I'm trying to write an application that will allow the user to change the time on a PDA. The time is locked down in the registry so it cannot be changed without hard resetting the PDA. The application is password protected but I'm missing the code to actually change the time.
I found out you cannot use TimeofDay to set the time.
Help.
P.S. Does anyone know the registry entry to lockdown the time on the PDA??
Thank You very Much
-
May 12th, 2006, 07:41 AM
#2
Fanatic Member
Re: Changing time on a PDA.
this following class will allow you to change the Date & time from within your application
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
In terms of locking down the registry i have no idea, but in any application i do i lock down the device by disabling the taskbar & startmenu, making my applicaiton full screen, and preventing the user from exiting the applicaiton without entering a password
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
-
May 12th, 2006, 09:24 AM
#3
Thread Starter
Junior Member
Re: Changing time on a PDA.
Barry,
Thank you for your reply.
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
|