Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Writing console programs with VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00398000
Message ID:
00399947
Vues:
16
>>>I've created a utility program which is essentially a workstation configuration tool. Now I'd like to be able to run it from the command line or from a batch file.
>>>
>>
>>VFP is a Winapp who's output is always directed to a Window, not a console. None of the native commands write to STDOUT. You'd have to fall back on writing through API calls, and completely hiding thr VFP main Window through CONFIG.FPW.
>
>I have wanted to do this forever. Can you give a simple "hello world" example?

Off the top of my head, without testing:
DECLARE INTEGER fopen IN MSVCRT.DLL AS _fopen ;
   STRING @ lpFileName, ;
   STRING mode
DECLARE INTEGER _lwrite IN WIN32API;
        INTEGER nFileHandle, ;
        STRING @ lpBuffer, ;
        INTEGER nSize
DECLARE INTEGER fclose IN MSVCRT AS _fclose INTEGER hFileHandle
nFH = _fopen("STDOUT",;
            "a")
cVar = "Hello, World" + CHR(13)+CHR(10)+CHR(0)
=_lwrite(nFH,cVar,15)
=_fclose(nFH)
This isn't the only way to do it. The AS clauses would be needed to avoid name collisions with internal VFP functions.
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform