Delphi 2010 RIDL 편집기에서 함수/프로 시저 포인터 유형의 특성을 인터페이스 정의에 정의 할 수 있는지 궁금합니다. 예를 들어 인스턴스를 작성할 때 구현 자의 CoCreator를 사용하여 해당 소스에 해당 인터페이스 정의를 사용하는 함수/프로 시저를 할당 할 수 있습니다. 사실 "???"을 채우는 방법을 알고 싶습니다.Delphi 2010 RIDL 편집기에서 함수/프로 시저 포인터 유형의 특성 정의
TLB 파일 :
IComIntf = interface(IDispatch)
...
function Get_OnDoSomething : ??? safecall;
procedure Set_OnDoSomething(const New_Event : ???); safecall;
...
property OnDoSomething : ???;
...
implementation
uses ComObj;
class function CoComIntf.Create: IComInt;
...
begin
Result := CreateComObject(CLASS_ComIntf) as IComIntf;
end;
구현 파일, ComIntfUnit.pas :
type
TOnDoSomething = function (Info: OleVariant): HResult of object;
TComIntf = class(TAutoObject, IComIntf)
private
fOnDoSomething : TDoSomething;
...
public
property OnDoSomething: TOnDoSomething read fOnDoSomething write fOnDoSomething;
...
클라이언트 형태 :
uses ComIntfUnit;
type
TForm1 = class(TForm)
private
{ Private declarations }
fCom : IComIntf;
function DoSomething(Info: OleVariant): HResult;
public
{ Public declarations }
...
end;
...
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
fCom := CoComIntf.Create;
fCom.OnDoSomething := DoSomething;
...
미리 감사드립니다.
안녕하세요, David, 귀하의 회신에 감사드립니다. 그렇다면 클라이언트 프로그램의 할당은 어떻게됩니까? 더 자세히 설명해주십시오. fCom.OnDoSomething : = DoSomething; – Zonouzi
할 수 없습니다. 디스패치를 지원하는 인터페이스가 아닙니다. 함수 포인터는 사용할 수 없습니다. ridl 편집장이 허용하지 않는 이유가 있습니다. 대신 인터페이스를 사용하십시오. –