Recent

Author Topic: Error interface method  (Read 2428 times)

AsleyCruz

  • Full Member
  • ***
  • Posts: 115
    • Graphic and web designer
Error interface method
« on: April 12, 2024, 04:58:38 pm »
Hi bros
I got this error on line 25 in the attached file uShellDragDrop.pp

uShellDragDrop.pp(25,17) Error: No matching implementation for interface method "SetData(const tagFORMATETC;var TagSTGMEDIUM;LongBool):LongInt; StdCall;" found

This file was working in a previous version of Lazarus 2.x,
now its not working with Lazarus 3.0.

Code: Pascal  [Select][+][-]
  1. TDataObject = class(TInterfacedObject, IDataObject)
  2. private
  3. ...

Can you please help me? Thanks a lot.
« Last Edit: April 12, 2024, 05:16:07 pm by AsleyCruz »
Graphic & web designer

Zoran

  • Hero Member
  • *****
  • Posts: 1948
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Error interface method
« Reply #1 on: April 12, 2024, 05:19:13 pm »
Hi bros
I got this error on line 25 in the attached file uShellDragDrop.pp

uShellDragDrop.pp(25,17) Error: No matching implementation for interface method "SetData(const tagFORMATETC;var TagSTGMEDIUM;LongBool):LongInt; StdCall;" found

This file was working in a previous version of Lazarus 2.x,
now its not working with Lazarus 3.0.

Code: Pascal  [Select][+][-]
  1. TDataObject = class(TInterfacedObject, IDataObject)
  2. private
  3. ...

Can you please help me? Thanks a lot.

The parameter "medium" of function SetData is declared as "var" in the interface, whereas in your implementation it is const. Probably used to be const, I don't know.

So, when you replace "const medium" with "var medium" it compiles.

Code: Pascal  [Select][+][-]
  1. function SetData(const formatetc: TFormatEtc; var medium: TStgMedium;
  2.       fRelease: BOOL): HRESULT; stdcall;
  3.  
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

 

TinyPortal © 2005-2018