标题中是否有这样的东西?我试图在转换an API structure的过程中做到这一点,并遇到以前没有遇到的事情:
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的人会看到明显的问题。你会如何解决这个问题?
答案 0 :(得分: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
没有问题。