Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting system Date and Time
Message
De
01/10/1997 10:14:21
Claudio Abad
Compañía Financiera Argentina
Buenos Aires, Argentine
 
 
À
30/09/1997 18:51:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00052546
Message ID:
00052632
Vues:
43
>Is there a method for setting the system date and/or time from a VFP application?
>
>Any help greatly appreciated
>
>Joao Pinheiro
>pinetree@mail.telepac.pt
Here's something that I fried my brain on (I hate bit math). This even
shows the example of passing a structure to a Win API. Also note: This is
on NT/Win95. You might be able to use the same function in the 16 bit
world, but call it in Kernel instead of Kernel32.

******* Begin Code ***********
DECLARE SetLocalTime IN "kernel32.dll" STRING @Time

*------------------------------------------
* cMyTime Structure is as follows
*
* DWORD = 2 bytes
*
* DWORD Year
* DWORD Month
* DWORD Day Of Week (0 = Sunday)
* DWORD Day Of Month
* DWORD Hour
* DWORD Minute
* DWORD Second
* DWORD Millisecond
*------------------------------------------
cMyTime =
ITOC(YEAR(DATE()))+ITOC(MONTH(DATE()))+ITOC(DOW(DATE())-1)
cMyTime = cMyTime+ITOC(DAY(DATE()))+ITOC(HOUR(DATETIME()))
cMyTime =
cMyTime+ITOC(MINUTE(DATETIME()))+CHR(0)+CHR(0)+CHR(0)+CHR(0)

= SetLocalTime(@cMyTime)

FUNCTION ITOC
LPARAMETERS nNumber

cReturnString = CHR(MOD(nNumber, 256)) + CHR(INT(nNumber/ 256))
RETURN cReturnString
******* End Code ***********

-= Ken =-

kenti@oz.net
kenti@msn.com
kenti001@aol.com
74441.1210@compuserve.com
This response was sended to me from Ken Title
I hope this helpfull
Excuse me English
I learn slowly
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform