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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing parameters from a exe or dll file 1

Status
Not open for further replies.

forostec

Programmer
Oct 5, 2004
13
0
0
CO
Hello, if possible to build an exe file or a dll file and execute it with parameters?

If so, how can i do this?
Thanks
 
Hi

Unless I'm misunderstanding, you're asking how to pass parameters to an exe?

if so, here's how you do it.

In the main module of your project, add a Parameter statement to the top of the program and build it as an exe

ie
Code:
Parameter cSomeValue

if you set up a shortcut to the exe and on the target text box add the parameter value you want to pass in eg;

Code:
C:\vfp_dev\v12\myexe.exe SOMEPARAMETERVALUE
I've never done this with a DLL just an exe,

Hope this helps, Mark

 
thanks for your replay but i don't think i explain myself quite well, i like something like this:

scandisk /autofix /surface

in my case it would be...

myfoxproexefile parameter1 parameter2.... etc

is it possible?

i just want to operate inside myfoxproexefile with the parameters.
 
markdenby has already provided the answer. Let's say you have a new project. You have two files, one is a prg called main.prg and the other is form call MyForm.scx In the project manager main.prg is "Set as Main" for the project, meaning that it will be run first and in it you have the following:
Code:
Parameters MyParam1, MyParam2, MyParam3

*!* Do something here with the parameters that are sent in

Do form MyForm
Read Events

Now you compile your project into MyApp.exe and run using the commandline:

C:\Progra~1\Company\MyApp.exe 1, 2, 3

...your app will start up and begin processing the code in main.prg...the parameters that were sent will be put in MyParam1, MyParam2, MyParam3 and you can do what you will with them and then your form will open and finally the foundation read will begin processing user events. That's it. You aren't going to be able to do "switches" like you show above, but you can certainly send parameters in to your exe using the commandline syntax that markdenby or myself have given you.

boyd.gif

 

"markdenby has already provided the answer"

ah but you explained it better Craig...

Thanks, Mark
 
Note: While it wasn't stated explicitly, this parameter passing technique won't work for VFP COM servers - .EXEs or .DLLs.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top