J
Justin Marshall
Greetings,
I would like to be able to programmatically change the system time. I have
found several suggestions in the archives and on the web but have had no
luck.
I have tried:
1. Microsoft.VisualBasic.TimeString = myDate.ToShortTimeString ->
NotSupportedException
2. Microsoft.VisualBasic.DateAndTime = myDate -> NotSupportedException
3.
Private Structure SystemTime
Public uYear As Short
Public uMonth As Short
Public uDayOfWeek As Short
Public uDay As Short
Public uHour As Short
Public uMinute As Short
Public uSecond As Short
Public uMilliseconds As Short
End Structure
<DllImport("Coredll.dll")> Private Function SetLocalTime(ByRef st As
SystemTime) As Boolean
End Function
Public Function SetDateTime(ByVal iYear As Integer, ByVal iMonth As Integer,
ByVal iDay As Integer, ByVal iHour As Integer, ByVal iMinute As Integer,
ByVal iSecond As Integer) As Boolean
Dim st As SystemTime
st.uYear = iYear
st.uMonth = iMonth
st.uDay = iDay
st.uHour = iHour
st.uMinute = iMinute
st.uSecond = iSecond
Return SetLocalTime(st)
End Function
This PInvoke code give me no error on the emulator but does NOT change the
system time.
On the device (Symbol 2846), it gives me a native exception (code
0x80000002).
Thanks in advance for any help you can offer.
Regards,
Justin.
I would like to be able to programmatically change the system time. I have
found several suggestions in the archives and on the web but have had no
luck.
I have tried:
1. Microsoft.VisualBasic.TimeString = myDate.ToShortTimeString ->
NotSupportedException
2. Microsoft.VisualBasic.DateAndTime = myDate -> NotSupportedException
3.
Private Structure SystemTime
Public uYear As Short
Public uMonth As Short
Public uDayOfWeek As Short
Public uDay As Short
Public uHour As Short
Public uMinute As Short
Public uSecond As Short
Public uMilliseconds As Short
End Structure
<DllImport("Coredll.dll")> Private Function SetLocalTime(ByRef st As
SystemTime) As Boolean
End Function
Public Function SetDateTime(ByVal iYear As Integer, ByVal iMonth As Integer,
ByVal iDay As Integer, ByVal iHour As Integer, ByVal iMinute As Integer,
ByVal iSecond As Integer) As Boolean
Dim st As SystemTime
st.uYear = iYear
st.uMonth = iMonth
st.uDay = iDay
st.uHour = iHour
st.uMinute = iMinute
st.uSecond = iSecond
Return SetLocalTime(st)
End Function
This PInvoke code give me no error on the emulator but does NOT change the
system time.
On the device (Symbol 2846), it gives me a native exception (code
0x80000002).
Thanks in advance for any help you can offer.
Regards,
Justin.