From 2ed5093ef2388c623632e925387dff4f5ab54bab Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 21 Mar 2013 14:47:12 +0000 Subject: demo: updated TNullInterfacedObject implementation. - It was missing the IUnknown declaration in the class - The IUnknown signature has changed in recent FPC versions. --- examples/gui/command_interface/commands.pas | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/gui/command_interface/commands.pas b/examples/gui/command_interface/commands.pas index c487b0b1..d4a30858 100644 --- a/examples/gui/command_interface/commands.pas +++ b/examples/gui/command_interface/commands.pas @@ -14,11 +14,11 @@ uses type // non reference counted interface - TNullInterfacedObject = class(TObject) + TNullInterfacedObject = class(TObject, IUnknown) protected - function QueryInterface(const IID: TGUID; out Obj): longint; stdcall; - function _AddRef: longint; stdcall; - function _Release: longint; stdcall; + function QueryInterface(constref iid : tguid;out obj) : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; + function _AddRef : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; + function _Release : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; end; @@ -44,7 +44,7 @@ uses { TNullInterfacedObject } -function TNullInterfacedObject.QueryInterface(const IID: TGUID; out Obj): longint; stdcall; +function TNullInterfacedObject.QueryInterface(constref IID: TGUID; out Obj): longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; begin if GetInterface(IID, Obj) then Result := 0 @@ -52,12 +52,12 @@ begin result := integer(e_nointerface); end; -function TNullInterfacedObject._AddRef: longint; stdcall; +function TNullInterfacedObject._AddRef: longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; begin Result := -1; end; -function TNullInterfacedObject._Release: longint; stdcall; +function TNullInterfacedObject._Release: longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; begin Result := -1; end; @@ -72,7 +72,7 @@ end; procedure TAddCommand.Execute; begin - Writeln('>> TAddComand.Execute'); + DebugLn('>> TAddComand.Execute'); FMemo.Lines.Add('Hello ' + IntToStr(Random(500))); FMemo.Invalidate; end; @@ -81,7 +81,7 @@ end; procedure TExitCommand.Execute; begin - Writeln('>> TExitComand.Execute'); + DebugLn('>> TExitComand.Execute'); fpgApplication.Terminated := True; end; -- cgit v1.2.3-70-g09d2