Recent

Author Topic: IMoniker error in CommonPrefixWith definition  (Read 825 times)

440bx

  • Hero Member
  • *****
  • Posts: 6381
IMoniker error in CommonPrefixWith definition
« on: June 26, 2025, 05:44:04 am »
Hello,

In Activex.pp, IMoniker is defined as follows:
Code: Pascal  [Select][+][-]
  1.     PIMoniker = ^IMoniker;
  2.     IMoniker = Interface (IPersistStream)
  3.       ['{0000000f-0000-0000-C000-000000000046}']
  4.       Function BindToObject (const pbc:IBindCtx;const mktoleft:IMoniker; const RiidResult:TIID;Out vresult):HResult;StdCall;
  5.       Function GetTimeOfLastChange(Const bc:IBindCtx;Const mkToLeft:IMoniker; out ft : FileTime):HResult; StdCall;
  6.  
  7.       { many methods "snipped" away }
  8.  
  9.       { the following definition is incorrect }
  10.  
  11.       Function CommonPrefixWith (Const mkOther:IMoniker):HResult; StdCall;
  12.  
  13.  
  14.       { remaining methods }
  15.  
  16.       Function RelativePathTo(Const mkother:IMoniker; Out mkRelPath : IMoniker):HResult;StdCall;
  17.       Function GetDisplayName(Const bc:IBindCtx;const mktoleft:IMoniker;Out szDisplayName: pOleStr):HResult; StdCall;
  18.       Function ParseDisplayName(Const bc:IBindCtx;Const mkToLeft:IMoniker;szDisplayName:POleStr;out cheaten:ULong;out mkOut:IMoniker):HResult; StdCall;
  19.       Function IsSystemMoniker(Out dwMkSys:DWord):HResult;StdCall;
  20.       End;
  21.  

In C/C++ the definition of CommonPrefixWith is:
Code: C  [Select][+][-]
  1. HRESULT CommonPrefixWith(
  2.   [in]  IMoniker *pmkOther,
  3.   [out] IMoniker **ppmkPrefix
  4. );
  5.  
which when translated to Pascal (following the pattern in activex.pp) would yield something like:
Code: Pascal  [Select][+][-]
  1.     function CommonPrefixWith(const mkOther: IMoniker;
  2.       out mkPrefix: IMoniker): HRESULT; stdcall;
  3.  
which is the definition found in JwaActivex.pas

Note that the definition in activex.pp is missing a parameter.

HTH.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18977
  • Glad to be alive.
Re: IMoniker error in CommonPrefixWith definition
« Reply #1 on: June 26, 2025, 08:25:35 am »
Unlike your other post, this one is for Marcov.. :P
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12786
  • FPC developer.
Re: IMoniker error in CommonPrefixWith definition
« Reply #2 on: June 26, 2025, 09:56:59 am »
Not really, since in my activex, imoniker is defined as       

Code: Pascal  [Select][+][-]
  1. Function CommonPrefixWith (Const mkOther:IMoniker;Out mkPrefix : IMoniker):HResult; StdCall;

both in trunk and fixes.  According to blame fixed in april 2024 with commented "reported in the forum", which usually means by a certain 440bx  :)

Thaddy

  • Hero Member
  • *****
  • Posts: 18977
  • Glad to be alive.
Re: IMoniker error in CommonPrefixWith definition
« Reply #3 on: June 26, 2025, 01:04:41 pm »
 :D :) :) :)
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

 

TinyPortal © 2005-2018