Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sys(0)
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Title:
Re: Sys(0)
Miscellaneous
Thread ID:
00590158
Message ID:
00590496
Views:
25
This message has been marked as a message which has helped to the initial question of the thread.
>>>My Win2K box returns < machine name >#< user name >.
>>
>>Is that from FPD/FPW?
>>
>>
>>>I personally wouldn't bother with it, however, if I was only interested in the user name. I'd use either the API or WSH.
>>
>>Can I do API or WSH in FPD? In FPW, parsing sys(0) seems easier than API + foxtools.
>>
>>Thanks.
>
>Sorry, Doru. I didn't check the category. Both FPW 2.6a and FPD 2.5 report < machine name ># < number >. No name IOW. Further, the GetUserName() function was not supported under Win 3.1, so that's out as well. As for the WSH, there's no mechanism to create the object. I've tried, via the RUN command and ShellExecute to run a script file without success.

Actually, there's a sick, twisted approach available (so of course it occurs naturally to me!) Write a WSH Script that emits the user name by instantiating Wscript.Network, and dump it to a file. Encapsulate the running of the script in a batch file, with at least the lines:
START CSCRIPT.EXE <i>name of your WSH Script</i>
EXIT
Now, inside your FPW (or FPD) app, fire off the batch file using RUN without the /N parameters - it launches a new instance of the CLI, says "It's a batch file, so I'll run it", and Windows now starts a Win32 VDM to process the batch file. Suddenly, your DOSApp or Win16App can now invoke a Win32 executable. You then suck down the result from the external execution.

BTW, using RUN without the /N makes it run synchronously, so FP doesn't continue until your script finishes running. Be sure that the FOXRUN.PIF has the 'Close on Exit' checkbox marked.

Obviously, the platform must be capable of running the WSH, and have it installed or this doesn't help a bit. The same thing can be used to call a VFP .EXE from within a DOSApp or Win16App.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform