如何将VC中的语句翻译成Delphi? ( 积分: 50 )

  • 主题发起人 主题发起人 landina
  • 开始时间 开始时间
L

landina

Unregistered / Unconfirmed
GUEST, unregistred user!
如何将VC中的语句翻译成Delphi?<br>DWORD MaxDriveSet;<br>if ( MaxDriveSet &amp; (1 &lt;&lt; drive) ) &nbsp;<br>{<br>...<br>}<br>我这样翻译错误出现在哪里?<br>var<br> &nbsp;MaxDriveSet: DWORD;<br>begin<br> &nbsp;if (MaxDriveSet and (1 shl drive))=1 then<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp;....<br> &nbsp; &nbsp;end;<br>end;
 
如何将VC中的语句翻译成Delphi?<br>DWORD MaxDriveSet;<br>if ( MaxDriveSet &amp; (1 &lt;&lt; drive) ) &nbsp;<br>{<br>...<br>}<br>我这样翻译错误出现在哪里?<br>var<br> &nbsp;MaxDriveSet: DWORD;<br>begin<br> &nbsp;if (MaxDriveSet and (1 shl drive))=1 then<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp;....<br> &nbsp; &nbsp;end;<br>end;
 
var<br> &nbsp;MaxDriveSet: DWORD;<br>begin<br> &nbsp;if (MaxDriveSet and (1 shl drive))&lt;&gt;0 then<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp;....<br> &nbsp; &nbsp;end;<br>end;
 
各位,如何将此结构翻译成delphi结构?<br><br>typedef struct _STORAGE_PROPERTY_QUERY {<br> &nbsp;STORAGE_PROPERTY_ID &nbsp;PropertyId;<br> &nbsp;STORAGE_QUERY_TYPE &nbsp;QueryType;<br> &nbsp;UCHAR &nbsp;AdditionalParameters[1];<br><br>} STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;<br><br>我翻译是否正确?<br><br> &nbsp;STORAGE_PROPERTY_QUERY=packed record<br> &nbsp; &nbsp;PropertyId: STORAGE_PROPERTY_ID;<br> &nbsp; &nbsp;QueryType: STORAGE_QUERY_TYPE;<br> &nbsp; &nbsp;AdditionalParameters: PChar;<br> &nbsp;end;
 
typedef struct _STORAGE_PROPERTY_QUERY {<br> &nbsp;STORAGE_PROPERTY_ID &nbsp;PropertyId;<br> &nbsp;STORAGE_QUERY_TYPE &nbsp;QueryType;<br> &nbsp;UCHAR &nbsp;AdditionalParameters[1];<br><br>} STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;<br><br>delphi<br><br>_STORAGE_PROPERTY_QUERY=record<br> &nbsp;PropertyId:STORAGE_PROPERTY_ID;<br> &nbsp;QueryType:STORAGE_QUERY_TYPE;<br> &nbsp;AdditionalParameters:Array[0..0] of UCHAR;<br>end;<br>STORAGE_PROPERTY_QUERY=_STORAGE_PROPERTY_QUERY;<br>PSTORAGE_PROPERTY_QUERY=^STORAGE_PROPERTY_QUERY;
 
to appfirst:<br>你这样翻译的结构在delphi中是无法得到正确结果的,问题已经解决了,不过也要谢谢你。<br><br>正确的翻译应该是:<br>_STORAGE_PROPERTY_QUERY=record<br> &nbsp;PropertyId:STORAGE_PROPERTY_ID;<br> &nbsp;QueryType:STORAGE_QUERY_TYPE;<br> &nbsp;AdditionalParameters:Array[0..512-1] of byte;<br>end;<br>STORAGE_PROPERTY_QUERY=_STORAGE_PROPERTY_QUERY;<br>PSTORAGE_PROPERTY_QUERY=^STORAGE_PROPERTY_QUERY;<br><br>分配内存空间时:<br>pStorage=(PStorage_Property_Query)allocmem(sizeof(Storage_Property_Query)+512-1)<br>这样就可以得到正确的结果
 

Similar threads

后退
顶部