Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Script to alter system date when starting VFP 8 Beta
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00749262
Message ID:
00749320
Views:
20
This message has been marked as the solution to the initial question of the thread.
>I am waiting for our purchase dept to leap into action and buy VFP 8.00 as they have promised.
>
>In the meantime we have been told by MS that we can turn the system date back in order to continue running the VFP 8.00 Beta. Once the Beta is running it is possible to set the system date back to what it should be.
>
>Obviously what is needed is a script that does the following
>
>1. writes the current date to an environment variable
>
>2. Runs VFP 8 Beta
>
>3. Pauses to make sure VFP is running
>
>4. Sets the system date to the date that was stored in the environment variable
>
>
>Has anyone done this yet. I tried briefly to do it in a batch file but could not manage to set the system date to set to the variable date.
>
>This can probably be done easily in WSH but I do not have the time to mess about.
>
>Does anyone have a script for me :)

I don't have a script, but I can tell you how I'd do it.

First, the WSH couldn't be used, because it does have the ability to directly access the API. What I'd do is create a prg to be run from an earlier version of VFP. Here are the steps:

1. Retrieve the current system time via GetSystemTime().
DECLARE GetSystemTime IN Win32API;
  STRING @lpsystemtime
lcsystime = REPLICATE(CHR(0), 16)
= GetSystemTime(@lcsystime)
2. Save it to another variable.
lcorgtime = lcsystime
3. Change the value of the month and date members to equal January 31, 2003.
lcsystime = STUFF(lcsystime, 3, 1, CHR(1))
lcsystime = STUFF(lcsystime, 7, 1, CHR(31))
4. Set the system time
DECLARE INTEGER SetSystemTime IN Win32API;
  STRING @lpsystemtime
= SetSystemTime(@lcsystime)
5. Start VFP 8.0 Beta

6. Yield processing time for 2 seconds
DECLARE Sleep IN Win32API;
  INTEGER dwmilliseconds
= Sleep(2000)
7. Restore the original system time.

Note, your clock will be about 2 seconds behind where you started.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform