Consider the following code:
uses
{... }
ComObj,
ShlObj;
type
TContextMenu = class(TComObject, IShellExtInit, IContextMenu)
private
{(*}
const
GUID: TGUID = '{99D8B139-0855-4C5D-95E7-BC8EC6254B3D}';
{*)}
private
FCmdCount: LongWord;
FDm: Tdm_ContextMenu;
protected
function IShellExtInit.Initialize = IShellExtInit_Initialize;
function IShellExtInit_Initialize(_pidlFolder: PItemIDList; _lpdobj: IDataObject;
_HKeyProgID: HKEY): HResult; stdcall;
function QueryContextMenu(_Menu: HMENU; _indexMenu, _idCmdFirst, _idCmdLast,
_UFlags: UINT): HResult; stdcall;
function InvokeCommand(var _ici: TCMInvokeCommandInfo): HResult; stdcall;
function GetCommandString(_idCmd, _uType: UINT; _pwReserved: PUINT;
_PszName: LPSTR; _cchMax: UINT): HResult; stdcall;
public
procedure Initialize; override;
destructor Destroy; override;
end;
This compiles fine in Delphi 2007 and XE but Delphi XE2 gives me the error: "[DCC Error] u_ContextMenuHandler.pas(16): E2291 Missing implementation of interface method IContextMenu.GetCommandString"
This has me baffled. I checked the interface declaration and my GetCommandString function has the exactly the same declaration as the interface's. Any hints?