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.
**********************************
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.