Active X Library and Com object
From: SimonW (bozzzza_at_lycos.co.uk)
Date: 06/28/04
- Next message: Rick Francken: "Re: delphi 6 and .net dlls"
- Previous message: Rob Kennedy: "Re: can't find regular Expression for String"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Jun 2004 16:58:31 +0100
Hi All,
I created a com server by creating a new active X library then placed then
a new com object. I then created a Method for the Interface through the
type library editor and it generated this code :-
ICoTest = interface(IUnknown)
['{06DE66DE-9220-464A-BABC-26833D994759}']
function AddNumbers(First: Integer; Second: Integer; out Answer:
OleVariant): HResult; stdcall;
end;
In the implementation class I filled in the following code :-
function TCoTest.AddNumbers(First, Second: Integer;
out Answer: OleVariant): HResult;
begin
try
Answer := First+Second;
result := S_OK;
except
result := E_FAIL;
end;
end;
I then compiled and registered the type library which generates the
following code for the function :-
function TCoTest.AddNumbers(First: Integer; Second: Integer; out Answer:
OleVariant): HResult;
begin
DefaultInterface.AddNumbers(First, Second, Answer);
end;
So far so good.
On using this interface method in com client, Delphi informs me that
the 'Return value of function 'TCotest.AddNumbers' might be undefined'
Ok looking at the code I realise there is no result, in the function that
has been created by the type library, why, and how would I stop this
messaging from appearing?
Also is there a pointer type in the type library editor for integers? I
couldn't find one, hence the reason I used OleVariant for the out parameter.
TIA
Simon.
- Next message: Rick Francken: "Re: delphi 6 and .net dlls"
- Previous message: Rob Kennedy: "Re: can't find regular Expression for String"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|