5

标题里有这样的东西吗?我正在尝试在转换API 结构的过程中执行此操作,但遇到了我以前从未遇到过的情况:

PFNReaderTranslatedDispatch = function(var msg: TMsg): BOOL; stdcall;
PFNReaderScroll = function(var prmi: TReaderModeInfo; dx, dy: integer): BOOL; stdcall;
TReaderModeInfo = record
  cbSize: DWord;
  hWnd: THandle;
  fFlags: DWord;
  prc: PRect;
  pfnScroll: PFNReaderScroll;
  fFlags2: PFNReaderTranslatedDispatch;
  lParam: DWord;
end;
PReaderModeInfo = ^TReaderModeInfo;

了解 Delphi 的人会看到明显的问题。你将如何解决这个问题?

4

1 回答 1

9

我认为这是最简单的解决方案:

PFNReaderTranslatedDispatch = function(var msg: TMsg): BOOL; stdcall;
PReaderModeInfo = ^TReaderModeInfo;
PFNReaderScroll = function(prmi: PReaderModeInfo; dx, dy: integer): BOOL; stdcall;
TReaderModeInfo = record
  cbSize: DWord;
  hWnd: THandle;
  fFlags: DWord;
  prc: PRect;
  pfnScroll: PFNReaderScroll;
  fFlags2: PFNReaderTranslatedDispatch;
  lParam: DWord;
end;

var实际上,您可以通过(按值)指针参数清楚地重新定义参数。PReaderModeInfo并且之前声明没有问题TReaderModeInfo

于 2013-05-02T17:41:30.773 回答