Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting Return Value from c# exe
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01597172
Message ID:
01597261
Views:
51
Hi Viv.
Many thanks for detailed explanation
I'll spend a bit of time seeing if I can implement
regards,
Gerard



>Create a project of type 'classLibrary'. e.g:
using System.Runtime.InteropServices;
>
>namespace GerardsDll
>{
>    [Guid("02AB9D93-1ED6-49A3-B52D-BE18C321ADB8")]
>    public interface IGerardsClass
>    {
>        int GetMeaningOfLife();
>    }
>
>    [Guid("E4B57315-4B86-4358-A0CD-18E319CCA0F1"),ClassInterface((ClassInterfaceType.None))]
>    public class GerardsClass : IGerardsClass
>    {
>        public int GetMeaningOfLife()
>        {
>            return 42;
>        }
>    }
>}
In the project properties:
>
>Application/Assembly Information : Check 'Make assembly COM visible'
>Build : Check 'Register for COM interop'
>
>In VFP :
x = CREATEOBJECT("GerardsCom.GerardsClass")
>? x.GetMeaningOfLife()
If you don't want/need intellisense then you can simply use:
public class GerardsClass
>    {
>        public int GetMeaningOfLife()
>        {
>            return 42;
>        }
>    }
To register on a different machine see RegAsm: http://msdn.microsoft.com/en-us/library/tzat5yw6(v=vs.110).aspx
>
>
>
>
>>Hi Viv. Thnaks for your reply
>>......But why don't you just expose the EXE as an OLE object ?
>>
>>Yes..it its simpler ...its a long time since I did anything like this ......how would I go about doing this ??
>>
>>Regards,
>>Gerard
>>
>>
>>
>>
>>>The returned integer is used as the error code. You probably need to use CreateProcess/GetLastError. Something like this:
>>>http://www.foxite.com/archives/shellexecute-and-wait-for-completion-0000085681.htm
>>>
>>>UPDATE: Or this: http://support.microsoft.com/kb/191584
>>>
>>>But why don't you just expose the EXE as an OLE object ?
>>>>Hi.
>>>>I have C# Console EXe whcih returns an integer in Main()
>>>>I want to Run the App from within Foxpro and get the Vlaue returned from the C# .exe
>>>>Anybody have any idea how this can be done?
>>>>My preference would be not to start ourputting the result to another file if its possibel to directly access the return value
>>>>
>>>>Tia
>>>>Gerard
Previous
Reply
Map
View

Click here to load this message in the networking platform