S
semman
Unregistered / Unconfirmed
GUEST, unregistred user!
本人要用Delphi写一个COM+的组件,以供ASP调用,但我写的组件可以被Delphi调用,但不能被ASP调用。
程序例子片段如下,
Type Library:
const
// TypeLibrary Major and minor versions
TestComMajorVersion = 1;
TestComMinorVersion = 0;
LIBID_TestCom: TGUID = '{8C4B82C5-8C7B-4E67-A9D3-CB66E1E49960}';
IID_ISimple: TGUID = '{34A3857E-6896-4ADE-A894-082AB2AD0E99}';
CLASS_Simple: TGUID = '{D213FCD5-B3F3-4ED9-95A8-CC4C9E8D712D}';
type
ISimple = interface;
Simple = ISimple;
ISimple = interface(IUnknown)
['{34A3857E-6896-4ADE-A894-082AB2AD0E99}']
function Get_Name(out Value: OleVariant): HResult; stdcall;
end;
Unit:
unit Unit1;
interface
uses
Windows, ActiveX, Classes, ComObj, TestCom_TLB, StdVcl;
type
TSimple = class(TTypedComObject, ISimple)
protected
function Get_Name(out Value: OleVariant): HResult; stdcall;
{Declare ISimple methods here}
end;
implementation
uses ComServ;
function TSimple.Get_Name(out Value: OleVariant): HResult;
begin
Value := 'Hello World!';
end;
initialization
TTypedComObjectFactory.Create(ComServer, TSimple, Class_Simple,
ciMultiInstance, tmApartment);
end.
请各位大侠多多帮忙。
程序例子片段如下,
Type Library:
const
// TypeLibrary Major and minor versions
TestComMajorVersion = 1;
TestComMinorVersion = 0;
LIBID_TestCom: TGUID = '{8C4B82C5-8C7B-4E67-A9D3-CB66E1E49960}';
IID_ISimple: TGUID = '{34A3857E-6896-4ADE-A894-082AB2AD0E99}';
CLASS_Simple: TGUID = '{D213FCD5-B3F3-4ED9-95A8-CC4C9E8D712D}';
type
ISimple = interface;
Simple = ISimple;
ISimple = interface(IUnknown)
['{34A3857E-6896-4ADE-A894-082AB2AD0E99}']
function Get_Name(out Value: OleVariant): HResult; stdcall;
end;
Unit:
unit Unit1;
interface
uses
Windows, ActiveX, Classes, ComObj, TestCom_TLB, StdVcl;
type
TSimple = class(TTypedComObject, ISimple)
protected
function Get_Name(out Value: OleVariant): HResult; stdcall;
{Declare ISimple methods here}
end;
implementation
uses ComServ;
function TSimple.Get_Name(out Value: OleVariant): HResult;
begin
Value := 'Hello World!';
end;
initialization
TTypedComObjectFactory.Create(ComServer, TSimple, Class_Simple,
ciMultiInstance, tmApartment);
end.
请各位大侠多多帮忙。