Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
..changing system time programmatically or by and Active
Message
De
18/10/2001 10:57:26
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00570089
Message ID:
00570264
Vues:
17
>>>Is there a way for change the system time using an Active X control ?
>>>Or maybe a way using code that probe to be is usefull ?
>>>
>>>
>>> Thanks for your answers ...
>>
>>I don't know ActiveX for it but you could do with API :
>>
>>
DECLARE INTEGER SetSystemTime IN win32api STRING @ lpTime
>>DECLARE INTEGER GetSystemTime IN win32api STRING @ lpTime
>>
>>lpCurrent = space(40)
>>GetSystemTime(@lpCurrent) && save current
>>
>>* Set to 29th Feb, 2000 16:45:10.0100
>>wYear = 2000
>>wMonth = 2
>>wDayOfWeek = 0 && ignored
>>wDay = 29
>>wHour = 16
>>wMinute = 45
>>wSecond = 10
>>wMilliseconds = 100
>>
>>cNewTime = Num2Word(wYear)+;
>>Num2Word(wMonth)+;
>>Num2Word(wDayOfWeek)+;
>>Num2Word(wDay)+;
>>Num2Word(wHour)+;
>>Num2Word(wMinute)+;
>>Num2Word(wSecond)+;
>>Num2Word(wMilliseconds)
>>
>>SetSystemTime(@cNewTime)
>>
>>? 'After setsystem time :',datetime()
>>SetSystemTime(@lpCurrent)
>>? 'Reset back to current :',datetime()
>>
>>Function Num2Word
>>lparameters tnDecimal
>>return chr(tnDecimal%256)+chr(int(tnDecimal/256))
Cetin
>
>Cetin,
>I wouldn't use the Systemtime functions. I would recommend the Localtime variations. Otherwise, when you set the time, you have to know the GMT offset and apply it so your clock isn't off by that much.
>
>The syntax is the same so there is no big deal in using the others, IMO.

Right Larry. Then I would add that you'd need to call SetLocalTime twice to be sure correct daylight saving is used.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform