Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting System Clock
Message
De
25/03/2003 08:45:07
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00769633
Message ID:
00769656
Vues:
19
>I've been doing some research on how I could change a systems clock through VFP8. Does it use the win32 api? Or is that just getting/setting system times on files?
>
>Any help would be appreciated! Thanks!
DECLARE INTEGER SetLocalTime IN win32api STRING @ lpTime
DECLARE INTEGER GetLocalTime IN win32api STRING @ lpTime
public lpCurrent
lpCurrent = space(40)
GetLocalTime(@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)

SetLocalTime(@cNewTime)
? datetime()
SetLocalTime(@cNewTime)
? datetime()
SetLocalTime(@lpCurrent)
? datetime()
SetLocalTime(@lpCurrent)
? datetime()

Function Num2Word
lparameters tnDecimal
return chr(tnDecimal%256)+chr(int(tnDecimal/256))
PS: Calling twice is intentional (daylight savings).
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform