>>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only