locked
COM Interop RRS feed

  • Question

  •  

     Hi,

     

    I have a large Foxpro business application that needs COM interop with a NET application I wrote for providing online help.

     

    I was able to integrate the two in a manner similar to that described in Rick Strahl’s "Accessing .NET Objects Through COM" (http://www.west-ind.com/presentations/VFPDOTNETiNTEROP/VFPDOTNETINTEROP.HTM). 

     

    After compiling the .NET project into a COM component, I instantiate its help class in my Foxpro app with CREATEOBJECT, and call a simple getHelp method with a couple parameters.

     

    While this approach has worked, I have run into problems, probably relating to the fact that the help app has a visual interface and that both apps seem to be running in the same process.  I have noticed odd interactions between the two apps, especially if help is launched from a modal window in Foxpro.

     

    My needs are very simple -- when a user clicks “Help”, launch the help app using two parameter strings.  If the help app is already open, just process the parameters.  The interaction is strictly one-way.

     

    I have zero experience working with COM, multithreading, or out-of-process contexts in Foxpro.  Frankly I’ve never needed it – until now.

     

    Any suggestions?

     

    Randy

     

     

    Saturday, June 23, 2007 5:54 PM

Answers

  • I'll give it a shot, although, my interop usually goes from .NET to VFP instead of the other way around:

    When you build your .NET project, make sure “Register For COM interop” checkbox is checked.  You're going from an "un-managed" environment to a managed one, so, interop needs to be setup for proper communication.  See this article for more info:

    http://blogs.msdn.com/calvin_hsia/archive/2006/07/14/665830.aspx

    Sunday, June 24, 2007 8:08 PM
  • Thanks,

     

    Yes, I do have "Register for COM interop" checked in my .NET project.

     

    I suspect that what I need to know is how to force my NET class object to run in a separate process.  While this may be a question for a .NET forum, if I could accomplish this feat entirely in Foxpro, I believe I could extend the solution to NET with a wrapper approach.

     

    For example, can one Foxpro app seamlessly launch another Foxpro app in a separate process and continue to communicate with it?  My automation needs are very basic.  However, I have to insure that only a single instance of the second app is created, and that the two are sufficiently independent of each other.

     

    Hopeful...

     

     

    Sunday, June 24, 2007 11:44 PM

All replies

  • I'll give it a shot, although, my interop usually goes from .NET to VFP instead of the other way around:

    When you build your .NET project, make sure “Register For COM interop” checkbox is checked.  You're going from an "un-managed" environment to a managed one, so, interop needs to be setup for proper communication.  See this article for more info:

    http://blogs.msdn.com/calvin_hsia/archive/2006/07/14/665830.aspx

    Sunday, June 24, 2007 8:08 PM
  • Thanks,

     

    Yes, I do have "Register for COM interop" checked in my .NET project.

     

    I suspect that what I need to know is how to force my NET class object to run in a separate process.  While this may be a question for a .NET forum, if I could accomplish this feat entirely in Foxpro, I believe I could extend the solution to NET with a wrapper approach.

     

    For example, can one Foxpro app seamlessly launch another Foxpro app in a separate process and continue to communicate with it?  My automation needs are very basic.  However, I have to insure that only a single instance of the second app is created, and that the two are sufficiently independent of each other.

     

    Hopeful...

     

     

    Sunday, June 24, 2007 11:44 PM