读取指定地址的数据 - ReadDataAddr
函数简介
读取指定地址的数据。
接口名称
ReadDataAddr
DLL调用
long ReadDataAddr(long instance, long hwnd, long addr, int len);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| hwnd | 长整数型 | 窗口句柄 |
| addr | 长整数型 | 地址 |
| len | 整数型 | 长度 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// hwnd 为目标窗口句柄
// 直接使用地址读取16字节数据
long strPtr = ReadDataAddr(instance, hwnd, 0x12345678, 16);
char* hexStr = GetStringFromPtr(strPtr);
printf("读取到的数据: %s\n", hexStr); // 输出如 "4A 5B 6C ..."
FreeStringPtr(strPtr);
Python
# 待补充
返回值
返回字符串的指针,格式为16进制字符串,每个字节以空格分隔。
注意事项
- 返回的字符串指针需调用 FreeStringPtr 释放内存。
