Re: Make a DLL in C# for FoxPro

Tech-Archive recommends: Fix windows errors by optimizing your registry



Andrus,

See inline:

"Andrus" <kobruleht2@xxxxxx> wrote in message
news:%238RTi6pYIHA.1168@xxxxxxxxxxxxxxxxxxxxxxx
VFP can not consume .NET components directly. You have to use a
bridging technology such as COM interop, as both .NET and VFP support the
creation/consumption of COM components (in this case, all that is needed
is for .NET to support the creation of COM components and for VFP to
support the consumption of them).

COM disadventages:

1. Forgot single click installation. Forgot zero footprint. Forgot running
from quest account -
It requires dll registration on every customer computer.

Wrong on all counts. You can use reg-free COM to use COM components
without registering them. Also, there is nothing that prevents the use of
COM objects from a guest account. Com objects are not limited by user
accounts (unless they are hosted in COM+, which one can specify
authorization to components).

Even still, registering the components is NOT that big of a deal. Also,
going the route in the blog entry that you pointed out ^still^ uses COM
interop, it just gets around the registration aspect of it. To be quite
frank, it's a ton of work for minimal gain.


2. .NET is not usable
Most .NET components do not expose COM interface. Almost every .NET
component requires to create wrapper dll.

Again, not true. Most of the types in the framework have the ComVisible
attribute attached to them. You will have to create your specific types so
that they are visible in COM, but most of the framework types are already
visible.


So COM is dead end.

Not by a longshot. The links you provided here both have workarounds
which eventally drop down to C++ to use it as a shim (and in some cases, COM
interop anyways), which is really MUCH more work than correctly implementing
a .NET component as a COM component.

If ^anyone^ is going to go through that much work just to get around
using COM, then they deserve the headaches that come from such a roundabout
solution.

Also, COM has been around for the past 15 years, it's deeply integrated
into Windows, and isn't going anywhere soon. Yes, it does require one to be
diligent in regards to versioning and registration, but they really aren't
such big issues. If they were, the technology wouldn't have matured to the
point where it has (where many other technologies and applications are built
on top of it).

It just requires a little understanding of it. Not reams of C++ code
and shims which produce minimal gains for maximal effort.

COM is not "dreaded" and it's not hard to understand or use. You just
have to be willing to understand it.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx


Your links don't support the idea that VPF can support consuming .NET
components directly. The first is a link to an ASP.NET-like environment
which is implemented on top of FoxPro.

From first link you can reach to the link

http://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=631

Which offers a way to Host the CLR directly. It shows wrapper dll source
code and allows to download samples.

The second link shows how to consume VFP functions in .NET (VB.NET
specifically) and it is through COM interop.

From second link you can reach to the link

http://blogs.msdn.com/calvin_hsia/archive/2006/08/07/691467.aspx

which contains C++ code to host the CLR as sample.

So both links provide ways to use .NET without dreaded COM interop from
VFP.

Andrus.



.



Relevant Pages

  • Re: Make a DLL in C# for FoxPro
    ... bridging technology such as COM interop, as both .NET and VFP support the ... creation/consumption of COM components (in this case, ... specifically) and it is through COM interop. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: How to handle open event in WSS
    ... interop it to one com component, so that we can use it as the unmanaged ... then you can create one VB.net class library project in VS.net and copy ... the method definition into the vb source file and start the implementation ... Microsoft Product Support Services ...
    (microsoft.public.sharepoint.portalserver.development)
  • Problems with COM+ Interop
    ... I'm having problems with a VFP COM+ objects that I'd like to use with ASP.NET. ... With the ASP.NET Interop Solution I just got Unspecifed error. ... Microsoft Visual FoxPro 9 SP1 ... Microsoft Visual Studio 2003 SP1 Enterprise ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Placing a .NET UserControl in a COM type "Wrapper"
    ... But it's just Interop, right? ... > supported, maybe it will work well, but it may also have strange behavior ... > Also, because IE and VS.net Winform can support hosting .Net control, so ... > Microsoft Online Partner Support ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • RE: Using managed code in unmanaged app
    ... "Exposing .NET Components to COM" ... ".NET Interop: Get Ready for Microsoft .NET by Using Wrappers to Interact ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.clr)