delphi - ""德尔福 : E2033 Types of actual and formal var parameters must be identical ""

标签 delphi

所以我收到此错误消息,有人可以帮助我吗,已经尝试了很多谷歌答案:p没有任何效果。

ReadProcessMemory 上的 ctrl+shift+space 结果

**Parameters** 
hProcess System.Cardinal 
IpBaseAddress System.Pointer 
IpBuffer System.Pointer 
nSize System.Cardinal 
IpNumberOfBytesRead System.Cardinal 
**Returns** 
System.Boolean 

指针函数:

Ptr Function: function Ptr(Value: Integer): Pointer;  

变量

var 
  Form1: TForm1; 
  PH : THandle; 
  PID, ThID: DWORD; 
  H : THandle;

function Ptr(Value: Integer): Pointer;
<小时/>

函数

function LerInt(Address: Integer): Integer;
var
  value:integer;
  ler:dword;
begin
  H := FindWindow(nil, 'Something Here :)');
  ThID := GetWindowThreadProcessID(H, @PID);
  PH := OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID);
  ReadProcessMemory(PH, Ptr(Address), @value, 4, ler); // THIS LINE
  Result:=value;
end;

最佳答案

变量ler的类型错误。它必须是 SIZE_T

其他评论:

  1. 您不需要函数来将整数转换为指针。只需使用Pointer(address) 进行转换即可。但请注意,如果您通过 64 位编译器传递此代码,您将遇到指针截断问题。
  2. 您不会检查任何 API 调用中的错误。请检查是否有错误。

关于delphi - ""德尔福 : E2033 Types of actual and formal var parameters must be identical "",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35071969/

相关文章:

Delphi 将字节数组转换为 TBytes - UDP 重定向?

android - 德尔福XE8。调音台。为什么Android平台上CLASS VAR的发布顺序不同?

delphi - 为什么我的子类没有继承父类的所有方法?

delphi - 迭代记录字段

delphi - 如何将位图附加到AggPas图像?

delphi - 尝试连接 Indy 10 服务器时客户端收到 'Connection Refused'

oracle - 测试 Delphi 应用程序的最佳方法

delphi - 使用TTreeview作为菜单

delphi - 以编程方式从cxradiogroup删除项目

delphi - Firebird 错误消息 "Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements"