The approach you described is pretty much what I did. Except I used a plain text file instead of the XML.
But the result was not what I wanted. So, I am working on some alternative approaches.
Thank you.
>It is possible, but may be more time consuming to implement. I have done this in the past, but it would be worth to do if you get more functionality than only a one liner.
>
>One simple workaround is to write the result to a temporary file, which you access via naming convention (fixed name) or pass as a parameter. Often I would create an XML file and send the path as parameter to the process, while the process then writes the response to the same file or to another XML file.
>
>You could create an XML file with the following structure to run code in a generic way:
>
>
><?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
><VFPData>
> <commands>
> <command>GetEnv("UserName")</command>
> <result></result>
> </commands>
></VFPData>
>
>
>You send this file to the VFP exe and it runs the defined command, and fills the result which then can be accessed by the caller.
>
>>Thank you. I doubt it.
>>
>>>Perhaps, you could use a COM DLL instead of an EXE and call that functions as a method. Like (in VFP, I don't know C#:
>>>
>>>
>>>oVFP= CREATEOBJECT('myVfpComClass') && Previously having registered "myVfpDll.dll"
>>>lcUserName= oVFP.GetUserName()
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>I need to call a small VFP .EXE from a C#/.NET code. The VFP project has one .PRG with has just one line:
>>>>
>>>>RETURN (GetEnv("UserName"))
>>>>
>>>>
>>>>How do I call this .EXE from C# code?
>>>>
>>>>I called VFP EXE in my C# code before using the Proc syntax. Example:
>>>>
>>>>Process Proc = Process.Start(cVfpExeFullPath, "1");
>>>>
>>>>
>>>>But before my VFP EXE didn't have to return anything. So, it was simple.
>>>>
>>>>Now I want the VFP EXE to return a value and capture this value in the C# code.
>>>>
>>>>How?
>>>>
>>>>TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham