Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A way to change system date/time programatically from VF
Message
From
14/09/1998 11:18:55
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00135525
Message ID:
00136216
Views:
30
Oh. I see. Thanks Ed. I've learned something new today.


>>George, Vlad
>>Thanks a lot to both of you, but i've checked this code and doesn't works in my system. I have Windows 98. What am i missing? Thanks again
>>
>>
>>lcsystime = "9801 0110201500"
>
>You have to build the binary structure required by SetLocalTime into the string, not pass an ASCII representation: FWIW, the structure looks like:
>
>
>    WORD wYear
>    WORD wMonth
>    WORD wDayOfWeek
>    WORD wDay
>    WORD wHour
>    WORD wMinute
>    WORD wSecond
>   WORD wMilliseconds
>
>
>A WORD is an unsigned 16 bit binary number ordered . A simple function that convert an integer to a WORD string would be:
>
>
>FUNCTION NumToWord
>LPARAMETER nNumBerToConvert
>RETURN CHR(MOD(nNumberToConvert,256)) + CHR(INT(nNumberToConvert/256))
>
>
>You could then make your SYSTEM_TIME structure:
>
>

>lcSystime> = NumToWord(1998) + ;
> NumToWord(1) + ;
> NumToWord(DOW({^ 1998 01 01})) + ;
> NumToWord(1) + ;
> NumToWord(0) + ;
> NumToWord(0) + ;
> NumToWord(0) + ;
> NumToWord(1)
>
>which would be midnight + 1 millisecond, January 1 1998.
>>
>>DECLARE SHORT SetLocalTime IN Win32API;
>> STRING @lpst
>>? SetLocalTime(@lcsystime) && returns 0
Saludos,
A.G.P.
---------
Previous
Reply
Map
View

Click here to load this message in the networking platform