Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you pass a parameter to a foxpro exe file

Status
Not open for further replies.

bebbo

Programmer
Joined
Dec 5, 2000
Messages
621
Location
GB
When starting a foxpro program outside of foxpro i.e in DOS or Windows, can you pass a parameter.

eg can I do something like :

test.exe with parameter

I know the above will not work but is there anything like the above I can do????
 
You sure can. At the top of your main .prg file, put the line:
Code:
lparameters param1
if pcount()>0
    (CODE TO PROCESS YOUR PARAMETER)
endif
When compiled into an exe file, you can either type:
Code:
DO MyPrg.EXE with MyParameter
or you can do it from a DOS box with:
Code:
MyPrg MyParameter
 
One thing that you should know ...

When execute your EXE with a parameter I believe that parameter will always be interpreted as type character.

For example: myprog 2

The parameter that your program picks up will be the Character "2" and you will need to use the VAL() function in order to convert it to the numerical value.

I am not 100% sure about all of this because it has been some time since I did this but thought I would pass it along just in case you run into it. Good luck.

Don
dond@csrinc.com

 
All parameters based to compiled EXE are characters.

The limit of passed varaibles is 27.

Any spaces in the passing of varibles are considered separete varibles.

something like this:

c:\vfp7.exe my passed parameter

is 3 separte varibles

c:\vfp7.exe 'my passed parameter'

would be one varible

Also as keep in mind the
Lparameters
must be the first line in your Main source file or it will not work.


Commas are not Required to separete varibles.

 
Note to self proof read

based = passed

sorry
 
You might also take a look at the save to and restore from command in VFP. Variables, arrays, and memo field can be passed beteeen .exe files with memory files. The file containing the memory variables has an extension of .mem. The .exe writting the file should place it so that the second .exe can easily find it like drive c: etc.



Leland
 
Thanks to everyone who responded, great help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top