You are on page 1of 4

How to pass parameters to VFP EXE | The Bereznikers

http://www.berezniker.com/content/pages/visual-foxpro/how-pass-param...

Home
Home

Visual Foxpro
Pages

SQL

Java

Office

Windows
Search

Visual Foxpro

Tags

How to pass parameters to VFP EXE


Submitted by Sergey on January 1, 2008 - 20:59 exe foxpro parameter parameters runtime vfp

code foxpro html


mssql wsh more tags

vfp vfp8 vfp9 winapi

sergey sql tsql

Passing command-line parameters from Windows to VFP created EXE is different from passing parameters to VFP programs or functions in VFP application: All parameters are passed to EXE as strings Parameters should not be enclosed in single quotes because quotes will be treated as part of parameter Parameters with spaces can be enclosed in double quotes Parameters are separated by spaces not commas In order to accept command-line parameters VFP application main program must begin with LPARAMETERS or PARAMETERS statement. A VFP form cannot be main in VFP application in this case because command-line parameters are not passed to the form's Init method. It's not recommended to use a switch like parameters (that starts with '-' or '/') because they may conflict with VFP command-line switches. The complete list of VFP switches can be found in Command-Line Switches topic in VFP help. Martina Jindr offers interesting alternative in Named Parameters. Here's an example that shows how to pass parameters and accept them in VFP EXE. This is sample code. Add error handling and adjust to your requirements as necessary.

Recent posts
One problem, one weekend, eight languages How to retrive Outlook default signature How to completely uninstall VFP 9.0 Retrieving VFP runtime DLL name required by EXE or DLL Send email via MSN email account Send email via Yahoo mail account Remove Structural CDX or Memo flag from a table Deleting pages from PDF file through Acrobat automation GDIPLUS.DLL security updates for VFP 8.0 and VFP 9.0 Powershell - Benchmark Command more

* Shortcut's command-line box "X:\Myapp\my.exe" 1234 "two items" 12/25/2002 .T. * Main program of my.exe LPARAMETERS tcPar1, tcPar2, tcPar3, tcPar4, tcPar5, tcPar6

Recent comments
I had the same issue 10 weeks 5 days ago My problemn is this: I'm 11 weeks 2 days ago You may create an exe in 11 weeks 6 days ago @Sergey, your code (cdo2000) 14 weeks 5 days ago Thanks guys.... 15 weeks 5 days ago Same code on powershell 15 weeks 6 days ago GetDefaultPrinter() 20 weeks 3 days ago This doesn't work for months 20 weeks 5 days ago

* Parameter | Value | Type | How to convert VFP 9.0 *--------------------------------------------------------------------------* tcPar1 "1234" C INT(VAL(tcPar1)) CAST(tcPa * tcPar2 "two items" C N/A N/A * tcPar3 "12/25/2002" C EVALUATE("{" + tcPar3 + "}") CAST(tcPa * tcPar4 ".T." C EVALUATE(tcPar4) CAST(tcPa * tcPar5 .F. L N/A N/A * tcPar6 .F. L N/A N/A When less parameters passed to EXE than specified in the LPARAMETERS, the rest of parameters will have logical type and .F. value. The PCOUNT() function can be used to determine the number of passed parameters. Sergey's blog 17523 reads

1 of 4

7/23/2013 12:30 PM

How to pass parameters to VFP EXE | The Bereznikers

http://www.berezniker.com/content/pages/visual-foxpro/how-pass-param...

Error sending email 21 weeks 6 days ago Check if EXE is running and optionally terminate it 22 weeks 6 days ago

Thanks
Submitted by Matt Pegg (not verified) on July 17, 2008 - 20:58. Short and sweet. Thanks Sergey. I've been looking for information everywhere on exe command line args for VFP apps. Very little information around. reply Permalink

Donate

Thank you...
Submitted by Simon (not verified) on December 12, 2009 - 08:44. This is so very helpful. THANK YOU! reply Permalink

Thank You!
Submitted by Svend Hst (not verified) on January 13, 2010 - 06:25. This was just what i needed ! Thanks. reply Permalink

Thanks! Really useful piece


Submitted by Pedro (not verified) on October 21, 2010 - 17:16. Thanks! Really useful piece of information. I've spent some time until found your advice and now my app works fine. reply Permalink

Excellent!!!
Submitted by Anonymous (not verified) on July 16, 2011 - 04:04. Excellent!!! reply Permalink

thanks
Submitted by Anonymous (not verified) on June 6, 2012 - 12:58. Really useful Thanks! reply Permalink

Very very fine ... thank you


Submitted by Anonymous (not verified) on June 8, 2012 - 06:22. Very very fine ... thank you very much

2 of 4

7/23/2013 12:30 PM

How to pass parameters to VFP EXE | The Bereznikers

http://www.berezniker.com/content/pages/visual-foxpro/how-pass-param...

reply

Permalink

can you make a sample project


Submitted by bqr.inno (not verified) on February 12, 2013 - 22:47. can you make a sample project of that ? reply Permalink

Post new comment


Your name: Anonymous E-mail:
The content of this field is kept private and will not be shown publicly.

Homepage:

Comment: *

Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> You can enable syntax highlighting of source code with the following tags:
<code>, <blockcode>, <java>, <powershell>, <tsql>, <visualfoxpro>.

The supported

tag styles are: <foo>, [foo]. Lines and paragraphs break automatically. Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options


By submitting this form, you accept the Mollom privacy policy.

Preview

3 of 4

7/23/2013 12:30 PM

How to pass parameters to VFP EXE | The Bereznikers

http://www.berezniker.com/content/pages/visual-foxpro/how-pass-param...

4 of 4

7/23/2013 12:30 PM

You might also like