Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unable to use WinExec
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00092940
Message ID:
00093036
Vues:
42
>>I was able to get another instance of VFP going (running an exe) from the command window with the following:
>>DECLARE SHORT CreateProcess IN Win32API;
>>  STRING @lpApplicationName,;
>>  STRING @lpCommandLine,;
>>  STRING @lpProcessAttributes,;
>>  STRING @lpThreadAttributes,;
>>  STRING bInheritHandles,;
>>  INTEGER dwCreationFlags,;
>>  STRING @lpEnvironment,;
>>  STRING @lpCurrentDirectory,;
>>  STRING @lpStartupInfo,;
>>  STRING @lpProcessInformation
>>* lcfile was the fully qualified executable file name
>>* lccmndline was the command line
>>* lcdir was its path
>>* lcfalse = CHR(0)
>>* lcStartupInfo, and lcProcessInfo were the same as yours
>>llresult = CreateProcess(@lcfile, @lccmndline, 0, 0, lcfalse, 0, 0, @lcdir, @lcStartupInfo, @lcProcessInfo)
>>If you can get this to work, I would suggest filling in some of the members of the STARTUPINFO structure. It'll give you more control.
>
>Yes, I can get this working from the command window too, but the problem I am having is getting it to work from within the EXE. I have run some further test, and it seems I can launch another EXE that is different from the EXE current running. For example inside A.EXE, I can do a WinExec("B.EXE", 1) with no problem, but I cannot do a WinExec("A.EXE", 1).
>
>Thanks again!

Well, WinExec() is provided for backward compatibility, so I'd recommend trying to work some more with CreateProcess(). One of the major differences is that in Win 95 and Win NT (32 bit) is that all apps run in their own address space, and for this reason alone, I think you'll stand a better chance of getting this to work with CreateProcess().

Good Luck,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform