thetempuser
Programmer
Hi,
I am using Vfp 8 on a Windows XP.
My goal is to create a VFP .exe that can start an external .exe. This external .exe (among other executables) will be located in the \plugins subfolder, in the folder of my VFP .exe.
VFP .exe location : C:\Test
External .exe location :C:\Test\plugins\create.exe
I tried this approach: an array with all the files from \plugins folder, loaded in a listbox on a form:
form.init
On the properties windows of the listbox:
colomncount=ALEN(MyFiles,2)
numberofelements=ALEN(MyFiles)
rowsource=MyFiles
rowsourcetype=5
The first problem appears when I run the form. It loads the files list in the listbox, but only the names, not the size, and the date. If I close the form and re-launch it, the whole information shown, name.exe, size and date. If I close VFP and open it, the same problem. The info is shown only after a second launch.
Now, the second problem is the way I launch the external exe.
The user double clicks on one of the exe from the listbox.
listbox1.dblclick
This code works if I run the form from VFP. If I build the VFP .exe it doesn't work. Nothing happens if I double click an .exe from the listbox.
It works if I use this code:
listbox1.dblclick
Thank you for your help.
I am using Vfp 8 on a Windows XP.
My goal is to create a VFP .exe that can start an external .exe. This external .exe (among other executables) will be located in the \plugins subfolder, in the folder of my VFP .exe.
VFP .exe location : C:\Test
External .exe location :C:\Test\plugins\create.exe
I tried this approach: an array with all the files from \plugins folder, loaded in a listbox on a form:
form.init
Code:
SET DATE TO dmy
PUBLIC plugpath
plugpath=Sys(5)+Sys(2003) &&gets current path
PUBLIC array MyFiles[1,5]
nFilesFound = ADIR( MyFiles, plugpath+"\plugins\*.exe","S",1)
On the properties windows of the listbox:
colomncount=ALEN(MyFiles,2)
numberofelements=ALEN(MyFiles)
rowsource=MyFiles
rowsourcetype=5
The first problem appears when I run the form. It loads the files list in the listbox, but only the names, not the size, and the date. If I close the form and re-launch it, the whole information shown, name.exe, size and date. If I close VFP and open it, the same problem. The info is shown only after a second launch.
Now, the second problem is the way I launch the external exe.
The user double clicks on one of the exe from the listbox.
listbox1.dblclick
Code:
a = ALLTRIM(thisform.list1.DisplayValue)
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin
cFileName = a
cAction = "open"
ShellExecute(0,cAction,cFileName,"","",1)
It works if I use this code:
listbox1.dblclick
Code:
a = plugpath+"\plugins\"+ALLTRIM(thisform.list1.DisplayValue)
run_command = [RUN /N]+a
&run_command
Thank you for your help.