summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-03-21 14:47:12 +0000
committerGraeme Geldenhuys <graemeg@gmail.com>2013-03-21 14:47:12 +0000
commit2ed5093ef2388c623632e925387dff4f5ab54bab (patch)
treefbcb4106ab296abf735a4ad20d567382f93f5013
parent865e7d4c2972df609b1e8556af35faf61f287775 (diff)
downloadfpGUI-2ed5093ef2388c623632e925387dff4f5ab54bab.tar.xz
demo: updated TNullInterfacedObject implementation.
- It was missing the IUnknown declaration in the class - The IUnknown signature has changed in recent FPC versions.
-rw-r--r--examples/gui/command_interface/commands.pas18
1 files changed, 9 insertions, 9 deletions
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;