2Pascal-新时代的Pascal
标题:
一段D7可以编译通过的代码在delphi 10.2.3上编译不通过,求...
[打印本页]
作者:
worm
时间:
2018-10-23 06:56
标题:
一段D7可以编译通过的代码在delphi 10.2.3上编译不通过,求...
部分代码:
procedure TFileWatchThread.Execute;
var
numBytes: DWORD;
CompletionKey: DWORD;
begin
while not Terminated do
begin
GetQueuedCompletionStatus( FPCompletionPort^, numBytes, CompletionKey, FPOverlapped, INFINITE);
if CompletionKey <> 0 then
begin
Synchronize(HandleEvent);
FBytesWritten := 0;
ZeroMemory(@FNotificationBuffer, SizeOf(FNotificationBuffer));
ReadDirectoryChanges(FPDirectoryHandle^, @FNotificationBuffer,
SizeOf(FNotificationBuffer), WatchSubTree, FNotifyFilter,
@FBytesWritten, @FOverlapped, nil);
end
else
Terminate;
end;
end;
完整代码见附件,代码部分有点儿长,就没有全部贴出来。
~~~~~~~~~~
出错提示: [dcc32 Error] Unit1.pas(185): E2033 Types of actual and formal var parameters must be identical
用D7可直接编译没有问题,换成delphi 10.2.3编译就不行了。求大神带路。~
出错点就在 GetQueuedCompletionStatus( FPCompletionPort^, numBytes, CompletionKey, FPOverlapped, INFINITE); 这一句。。
作者:
worm
时间:
2018-10-23 07:38
找到原因了,delphi 10.2.3 修改了这个函数定义:
function GetQueuedCompletionStatus(CompletionPort: THandle;
var lpNumberOfBytesTransferred: DWORD; var lpCompletionKey: ULONG_PTR;
var lpOverlapped: POverlapped; dwMilliseconds: DWORD): BOOL; stdcall;
所以出错的位置这样子修改:
GetQueuedCompletionStatus( FPCompletionPort^, numBytes, ULONG_PTR(CompletionKey), FPOverlapped, INFINITE);
就可以编译通过了。。
作者:
jianswu
时间:
2019-12-2 04:51
谢谢提示,记下了
欢迎光临 2Pascal-新时代的Pascal (http://2pascal.com/)
Powered by Discuz! X3