Dot Net Code in a Not Net World

  • Thread starter Thread starter db_from_mn
  • Start date Start date
D

db_from_mn

Is it possible for me to create, using a .NET language,
controls that are usable in a non-.Net application?
Specifically, I have a customer that uses Delphi. Could I
package code for interfacing with my USB-based device
into a form that he can use?
If so, could you suggest a general strategy?

By the way, I'm starting with no experience in this area.
Thanks in advance,
Dennis
 
Dennis,

Using .NET, you can export COM objects on your own. However, exporting
ActiveX controls is not supported. However, Chris Sells has a workaround
that is *EXTREMELY* unsupported, if you wish. The article is titled
"Hosting Windows Forms Controls in COM Control Containers" and is located at
(watch for line wrap):

http://www.ondotnet.com/pub/a/dotnet/2003/01/20/winformshosting.html

However, you can export COM components of a non-visual nature any way
you wish.

Hope this helps.
 
Hi Nick,
Thanks for the advice.
I'll check it out.
Dennis
-----Original Message-----
Dennis,

Using .NET, you can export COM objects on your own. However, exporting
ActiveX controls is not supported. However, Chris Sells has a workaround
that is *EXTREMELY* unsupported, if you wish. The article is titled
"Hosting Windows Forms Controls in COM Control Containers" and is located at
(watch for line wrap):

http://www.ondotnet.com/pub/a/dotnet/2003/01/20/winformsh osting.html

However, you can export COM components of a non- visual nature any way
you wish.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Is it possible for me to create, using a .NET language,
controls that are usable in a non-.Net application?
Specifically, I have a customer that uses Delphi. Could I
package code for interfacing with my USB-based device
into a form that he can use?
If so, could you suggest a general strategy?

By the way, I'm starting with no experience in this area.
Thanks in advance,
Dennis


.
 
Dennis,

No this isn't supported (yet). The question really is what component
standards does Delphi support? If your client is working with an older
version of Borland's Delphi it probably only supports Microsoft's
ActiveX. ActiveX is part of the COM standard, but it also adds user
interface support. This was the embeded standard for delivering
components with user interface before .NET. When Microsoft built .NET
they provided a two way bridge for COM interop (COM components can
communicate with .NET class libraries, vise versa), however they did
not provide this level of interop for ActiveX components. Chris Sells
article explains how to hack away at the registry to trick the
Framework and the host application into allowing this to work, but
it's not practicle to build and deploy a solution with unsupported
hack techniques it's irresponsible really.

One path you might want to take is with Delphi 8 for the .NET
Framework, if your client can migrate (or has migrated) to this
product you can easily create .NET User Interface controls and use
them.

If your wanting to provide a user interface component that
encapsulated logic to access a USB device, your USB communication
logic is going to have to be written outside of .NET anyway (or using
PInvoke to make unmanaged Win32 API calls). This may be something more
suitable for using Visual C++ and MFC to build an ActiveX control.

Hope this was helpful,

Jeremy
 
Back
Top