J'utilise ce code pour essayer de changer la date systeme de mon PDA fonctionnant sou WinCE 4.2 mais il me retourne tjour NotSupportedExeption...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 Private Declare Function SetSystemTime Lib "coredll.dll" (ByRef newTime As SYSTEMTIME) As Long Public Structure SYSTEMTIME Dim wYear As Integer Dim wMonth As Integer Dim wDayOfWeek As Integer Dim wDay As Integer Dim wHour As Integer Dim wMinute As Integer Dim wSecond As Integer Dim wMilliseconds As Integer End Structure Public Function SetDate(Optional ByVal mAnnee As Integer = 0, Optional ByVal mMois As Integer = 0, Optional ByVal mJour As Integer = 0, Optional ByVal mHeure As Integer = 0, Optional ByVal mMinute As Integer = 0, Optional ByVal mSeconde As Integer = 0, Optional ByVal mMilliseconde As Integer = 0) As Long Dim retValue As long Try Dim maNouvelleDate As SYSTEMTIME If mAnnee = 0 Then maNouvelleDate.wYear = Date.Now.Year Else maNouvelleDate.wYear = mAnnee End If If mMois = 0 Then maNouvelleDate.wMonth = Date.Now.Month Else maNouvelleDate.wMonth = mMois End If If mJour = 0 Then maNouvelleDate.wDay = Date.Now.Day Else maNouvelleDate.wDay = mJour End If If mHeure = 0 Then maNouvelleDate.wHour = Date.Now.Hour Else maNouvelleDate.wHour = mHeure End If If mMinute = 0 Then maNouvelleDate.wMinute = Date.Now.Minute Else maNouvelleDate.wMinute = mMinute End If If mSeconde = 0 Then maNouvelleDate.wSecond = Date.Now.Second Else maNouvelleDate.wSecond = mSeconde End If If mMilliseconde = 0 Then maNouvelleDate.wMilliseconds = Date.Now.Millisecond Else maNouvelleDate.wMilliseconds = mMilliseconde End If maNouvelleDate.wDayOfWeek = -1 retValue = SetSystemTime(maNouvelleDate) Catch ex As Exception retValue = 0 MsgBox(ex.Message) End Try return retValue End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click SetDate(2006, 3, 5) End Sub
Quelqu'un serait'il ou est l'erreur...?
Merci d'avance...
Partager