I have a com object that I need ported over to .net. They dont go over
too easy, since there is no .net equilivilant of ComSrv. Yet I cant figure
out how to create a com object in delphi for .net.
Can anyone help?
> Can anyone help?
Creating COM objects in .NET is very different to Delphi.
Basically any object can be surfaced as a COM object. Use the
ComVisible attribute to specify what you want to be visible via COM
(Classes, methods, properties) and give your class a Guid attribute.
After compiling your assembly use RegAsm to register it.
--
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com
I set the ComVisible to true and gave it a guid, I still can not reg the
dll with regsvr32. Since Im new to .net can you fill in here to give me a
jump start?
Class1.pas has a class in it I want to expose to com....
library comtest;
{%DelphiDotNetAssemblyCompiler
'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'}
{%DelphiDotNetAssemblyCompiler
'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'}
{%DelphiDotNetAssemblyCompiler
'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.XML.dll'}
uses
SysUtils,
Classes,
System.Reflection,
System.Runtime.InteropServices,
Class1 in 'Class1.pas'; <-want to expose class1.testproc()
//other assembly code generated by delphi
[assembly: ComVisible(True)]
[assembly: Guid('E0782317-10A6-4CB3-B9F1-A3616CDFEDAF')]
[assembly: TypeLibVersion(1, 0)]
begin
//do I put something here to make the procs visible?
end.
Thanks again Marc.
"Marc Rohloff [TeamB]" <"on request"> wrote in message
news:4lkuyky4...@marcrohloff.40tude.net...
> I set the ComVisible to true and gave it a guid, I still can not reg the
> dll with regsvr32. Since Im new to .net can you fill in here to give me a
> jump start?
You need to use regasm to register .NET assemblies for COM. If you are
using Delphi 2005 you can also use tregsvr.
You probably want to read this:
http://blogs.borland.com/cbensen/archive/2004/12/08/2111.aspx
Eventually, this com object needs to be called from jscript using the
createObject( myInterface.myClass) function
(Its for a windows media center plug in ). Am I on the right path to be
able to do that using the techique you described?
thanks,
Rich
"Marc Rohloff [TeamB]" <"on request"> wrote in message
news:rljhzokq333n$.dlg@marcrohloff.40tude.net...
> (Its for a windows media center plug in ). Am I on the right path to be
> able to do that using the techique you described?
AFAIK, Yes.
p.s. What does AFAIK mean?
"Marc Rohloff [TeamB]" <"on request"> wrote in message
news:1a2hqp0g...@marcrohloff.40tude.net...
> Thanks Marc, Youre the best!
>
> p.s. What does AFAIK mean?
AFAIK, it means "As far as I know"
--
Carl