Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use 'DO command IN exe' WITH ?
Message
From
18/08/2010 20:44:58
 
 
To
18/08/2010 09:21:04
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01476909
Message ID:
01477215
Views:
66
>>>>>I have a VFP9 exe (let's call it myVFP.exe) sitting in the same folder as my project file (let's call it myProject). myVFP.exe has a bunch of procedure files built into it and I'd like to call one of those procedures (let's call it myProcedure) from a form in myProject. The help file says that I should be able to do this using the syntax, "DO ProgramName1 | ProcedureName [IN ProgramName2] [WITH ParameterList]". So, naturally I tried the following command in my form's load event:
>>>>>
>>>>>DO myProcedure IN myVFP.exe WITH "someparam"
>>>>>
>>>>>and I receive "Procedure 'myProcedure' not found". The help file says, "If...the specified procedure isn't in the program file, the message "Procedure is not found" appears". I'm thinking that the latter message is kinda that same as what I receive. So, this begs the question, why do I get this error? I know for a fact that myVFP.exe has that procedure built into it.
>>>>>
>>>>>Is this not possible or am I doing something wrong. Any assistance is greatly appreciated.
>>>>
>>>>Did you try switching the order of parameters around
>>>>
>>>>do myProc with .. in ...
>>>>
>>>>I think I read here that Help may be incorrect.
>>>
>>>
>>>I tried your suggestion and that didn't make a difference.
>>>
>>>Googling didn't get me anywhere either. Seems like a very uncommon thing to do in VFP then?
>>
>>Did you try
>>
>>set procedure to myVFP.exe ?
>
>No, but if I do, I get the error, "File 'myProcedure.prg' does not exist."

One correct way is this:

Step 1

Create a project that will host your PROCEDURE file. Call it myprocs.pjx
Create a main.prg, set it as the main file and add one line of code to it:
SET PROCEDURE TO myProc.prg ADDITIVE
<pre>

Add your procedure file (called myProc.prg) to this project and compile the lot into an <b>MYPROCS.APP</b>. EXE's don't work for this. An APP is needed.


Step 2
Now create your main application project and in the first line of the main program

<pre>DO MYPROCS.APP
Then wherever you want to call the Function in your proc file
* your function is called myproc1
Store "myproc1" to FuncCall
DO ("FuncCall") With P1, p2, pn
Or use the macro (&) to call it.
FuncCall = "DO myproc1 WITH p1,p2,pn"
&FuncCall
You can even get return values this way using a macro.

Bernard
Previous
Reply
Map
View

Click here to load this message in the networking platform