请问C++中的LPVOID对应于Delphi中的什么类型? ( 积分: 300 )

  • 主题发起人 主题发起人 piao40993470
  • 开始时间 开始时间
P

piao40993470

Unregistered / Unconfirmed
GUEST, unregistred user!
[:D]<br>请问C++中的LPVOID对应于Delphi中的什么类型?<br>(我现在是把它当Pointer处理,但从函数中转换得到的数据与在C++下面的不一致
 
[:D]<br>请问C++中的LPVOID对应于Delphi中的什么类型?<br>(我现在是把它当Pointer处理,但从函数中转换得到的数据与在C++下面的不一致
 
就是Pointer啊。
 
是对应Pointer类型。<br>如果你转换后不对,应该是你的代码的问题.<br><br><br>举个例子<br>BOOL VirtualProtectEx(<br> &nbsp;HANDLE hProcess,<br> &nbsp;LPVOID lpAddress,<br> &nbsp;SIZE_T dwSize,<br> &nbsp;DWORD flNewProtect,<br> &nbsp;PDWORD lpflOldProtect<br>);<br><br>对应Delphi中的声明<br>function VirtualProtectEx(hProcess: THandle; lpAddress: Pointer;<br> &nbsp;dwSize, flNewProtect: DWORD; lpflOldProtect: Pointer): BOOL;<br> &nbsp;external kernel32 name 'VirtualProtectEx';<br>function VirtualProtectEx(hProcess: THandle; lpAddress: Pointer;<br> &nbsp;dwSize, flNewProtect: DWORD; var OldProtect: DWORD): BOOL;<br> &nbsp;external kernel32 name 'VirtualProtectEx';
 
『Delphi和C++数据类型对照表』<br><br>Delphi &nbsp; &nbsp; &nbsp; &nbsp; 字长/值域 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; C++<br>ShortInt &nbsp; &nbsp; 8位有符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; signed char<br>SmallInt &nbsp; &nbsp; 16位有符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; short<br>LongInt &nbsp; &nbsp; &nbsp; 32位有符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int<br>Byte &nbsp; &nbsp; &nbsp; &nbsp; 8位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned char<br>Word &nbsp; &nbsp; &nbsp; &nbsp; 16位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned short<br>Integer &nbsp; &nbsp; &nbsp; 32位有符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int<br>Cardinal &nbsp; &nbsp; 32位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned int<br>Boolean &nbsp; &nbsp; &nbsp; 真/假 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool<br>ByteBool &nbsp; &nbsp; 真/假 或 8位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned char<br>WordBool &nbsp; &nbsp; 真/假 或 16位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned short<br>LongBool &nbsp; &nbsp; 真/假 或 32位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BOOL (WinAPI)<br>AnsiChar &nbsp; &nbsp; 8位无符号字符 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char<br>WideChar &nbsp; &nbsp; 宽字编码字符 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wchar_t<br>Char &nbsp; &nbsp; &nbsp; &nbsp; 8位无符号字符 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char<br>AnsiString &nbsp; Delphi的字符串类 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AnsiString 类<br>String[n] &nbsp; &nbsp; 老式的Delphi字符串, n = 1..255字节 &nbsp; &nbsp; SmallString&amp;lt;n&amp;gt; 模板类<br>ShortString &nbsp; 老式的Delphi字符串, 255字节 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SmallString&amp;lt;255&amp;gt;<br>String &nbsp; &nbsp; &nbsp; Delphi的AnsiString类 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AnsiString<br>Single &nbsp; &nbsp; &nbsp; 32位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float<br>Double &nbsp; &nbsp; &nbsp; 64位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double<br>Extended &nbsp; &nbsp; 80位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long double<br>Real &nbsp; &nbsp; &nbsp; &nbsp; 32位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double<br>Pointer &nbsp; &nbsp; &nbsp; 32无类型指针 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void *<br>PChar &nbsp; &nbsp; &nbsp; &nbsp; 32位字符型指针 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned char *<br>PAnsiChar &nbsp; &nbsp; 32位ANSI型字符指针 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned char *<br>Comp &nbsp; &nbsp; &nbsp; &nbsp; 64位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comp 类<br>OleVariant &nbsp; OLE可变类型值 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OleVariant 类
 
谢谢xeen,wr960204<br>既然类型转换没错,那我再从代码上找找原因[:)]<br>(中午散分)
 
耶找到原因,果然是自己代码的问题![8D](哎,是自己小脑不够发达)<br>散分
 
接受答案
 
后退
顶部