Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting system Date and Time
Message
From
01/10/1997 19:21:57
 
 
To
01/10/1997 10:14:21
Claudio Abad
Compañía Financiera Argentina
Buenos Aires, Argentina
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00052546
Message ID:
00052774
Views:
38
>>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

This sample is wrong: DWORD is 4 bytes, not 2 bytes.

Vlad
Previous
Reply
Map
View

Click here to load this message in the networking platform