Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an new COM object and Error:Inconsistent Property Functions 1

Status
Not open for further replies.

looknow12

Programmer
Mar 14, 2004
12
US
I'm trying to write my first Com Object and running into problems. When I try to save the object I receive an error message Inconsistent Property Functions. Here's the code.

**********************************
unit multiplyu;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
Windows, ActiveX, Classes, ComObj, comtest_TLB, StdVcl;

type
Tmultiply = class(TTypedComObject, Imultiply)
private
FX : integer;
FY : integer;
protected
function DoIt: SYSINT; stdcall;
function Get_x(out Value: SYSINT): HResult; stdcall;
function Get_y(out Value: SYSINT): HResult; stdcall;
function Set_x(Value: Integer): SYSINT; stdcall;
function Set_y(Value: Integer): SYSINT; stdcall;
{Declare Imultiply methods here}
end;

implementation

uses ComServ;

function Tmultiply.DoIt: SYSINT;
begin
result := FX * FY;
end;

function Tmultiply.Get_x(out Value: SYSINT): HResult;
begin
result := FX;
end;

function Tmultiply.Get_y(out Value: SYSINT): HResult;
begin
result := FY;
end;

function Tmultiply.Set_x(Value: Integer): SYSINT;
begin
FX := value;
end;

function Tmultiply.Set_y(Value: Integer): SYSINT;
begin
FY := value;
end;

initialization
TTypedComObjectFactory.Create(ComServer, Tmultiply, Class_multiply,
ciMultiInstance, tmApartment);
end.

 
Code:
function Tmultiply.Get_x(out Value: [COLOR=red]SYSINT[/color]): HResult;
begin
 result := FX;
end;

function Tmultiply.Set_x(Value: [COLOR=red]Integer[/color]): [COLOR=red]SYSINT[/color];
begin
 FX := value;
end;

---> And same for _y

1) Try making your get and set methods compatible at type level.

2) SYSINT have a restricted automation compatibility, don't use it.

3) If all of the above fails, post the IMultiply definition too.

buho (A).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top