PARvalue VC自定义结构转DELPHI,请各位高手帮忙 ( 积分: 200 )

  • 主题发起人 主题发起人 dongruxue
  • 开始时间 开始时间
D

dongruxue

Unregistered / Unconfirmed
GUEST, unregistred user!
VC定义如下:<br>Typedef&nbsp;union /*&nbsp;This&nbsp;structure&nbsp;is&nbsp;used&nbsp;to&nbsp;pass&nbsp;values&nbsp;into&nbsp;and&nbsp;*/<br>&nbsp;&nbsp;&nbsp;&nbsp;{ /*&nbsp;out&nbsp;of&nbsp;hsc_param_value()&nbsp;*/<br>&nbsp;&nbsp;&nbsp;&nbsp;GDAVARIANT var;<br>&nbsp;&nbsp;&nbsp;&nbsp;char text[PARAM_MAX_STRING_LEN+1];<br>&nbsp;&nbsp;&nbsp;&nbsp;short int2;<br>&nbsp;&nbsp;&nbsp;&nbsp;long int4;<br>&nbsp;&nbsp;&nbsp;&nbsp;int8 int8;<br>&nbsp;&nbsp;&nbsp;&nbsp;float real;<br>&nbsp;&nbsp;&nbsp;&nbsp;double dble;<br>&nbsp;&nbsp;&nbsp;&nbsp;struct&nbsp;{<br> &nbsp;&nbsp;&nbsp;long ord;<br> &nbsp;&nbsp;&nbsp;char text[PARAM_MAX_STRING_LEN+1];<br> &nbsp;&nbsp;&nbsp;}&nbsp;en;<br>&nbsp;&nbsp;&nbsp;&nbsp;struct&nbsp;{<br> ULONG cSize; /*&nbsp;size&nbsp;of&nbsp;serialized&nbsp;variant&nbsp;*/<br> BYTE *pData; /*&nbsp;pointer&nbsp;to&nbsp;serialized&nbsp;variant&nbsp;*/<br> }&nbsp;servar;<br>&nbsp;&nbsp;&nbsp;&nbsp;long&nbsp;time[2];<br>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;PARvalue;<br>请精通过VC,DELPHI的朋友帮忙。
 
type<br><br>Ten=record<br>&nbsp;&nbsp;ord:&nbsp;long;<br>&nbsp;&nbsp;text:&nbsp;array[0..PARAM_MAX_STRING_LEN]<br>end;<br><br>Tservar=record<br>&nbsp;&nbsp;cSize:&nbsp;longword;<br>&nbsp;&nbsp;pData:&nbsp;PBYTE;<br>end;<br><br>TMyUnion=&nbsp;record<br>&nbsp;&nbsp;case&nbsp;Integer&nbsp;of<br>&nbsp;&nbsp;&nbsp;&nbsp;0:(en:&nbsp;Ten);<br>&nbsp;&nbsp;&nbsp;&nbsp;1:(servar:&nbsp;Tservar);<br>&nbsp;&nbsp;&nbsp;&nbsp;var:&nbsp;GDAVARIANT;<br>&nbsp;&nbsp;&nbsp;&nbsp;text:&nbsp;array[0..PARAM_MAX_STRING_LEN];<br>&nbsp;&nbsp;&nbsp;&nbsp;int2:&nbsp;shortint;<br>&nbsp;&nbsp;&nbsp;&nbsp;int4:&nbsp;long;<br>&nbsp;&nbsp;&nbsp;&nbsp;int8:&nbsp;int8;//这个我不知道是什么类型<br>&nbsp;&nbsp;&nbsp;&nbsp;real:&nbsp;longword;<br>&nbsp;&nbsp;&nbsp;&nbsp;dble:&nbsp;longword;<br>&nbsp;&nbsp;&nbsp;&nbsp;time:&nbsp;array[0..1]&nbsp;of&nbsp;long;<br>end;<br><br>var&nbsp;PARvalue:&nbsp;TMyUnion;
 
非常感谢_Murray帮忙,程序试运行未通过,问题在VAR:GDAVARIANT,该结构的VC定义如下:<br>typedef&nbsp;PROPVARIANT&nbsp;GDAVARIANT;<br><br>typedef&nbsp;/*&nbsp;[switch_type]&nbsp;*/&nbsp;union&nbsp;tag_GDAVALUEUNION<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()][string]&nbsp;*/&nbsp;unsigned&nbsp;char&nbsp;__RPC_FAR&nbsp;*pText;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;short&nbsp;int2;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;int&nbsp;int4;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;int8&nbsp;int8;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;float&nbsp;real;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;double&nbsp;dble;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;ENUMITEM&nbsp;en;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;GDAERR&nbsp;Status;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;GDASERVAR&nbsp;servar;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;POINTREFLIST&nbsp;PointList;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;GDAVARIANT&nbsp;__RPC_FAR&nbsp;*pVar;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[case()]&nbsp;*/&nbsp;long&nbsp;time[&nbsp;2&nbsp;];<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[default]&nbsp;*/&nbsp;&nbsp;/*&nbsp;Empty&nbsp;union&nbsp;arm&nbsp;*/&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;} GDAVALUEUNION;<br>请帮忙
 
其它相关结构<br>typedef&nbsp;struct&nbsp;tagGDASERVAR<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;DWORD&nbsp;cSize;<br>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;[size_is]&nbsp;*/&nbsp;unsigned&nbsp;char&nbsp;__RPC_FAR&nbsp;*pData;<br>&nbsp;&nbsp;&nbsp;&nbsp;} GDASERVAR;<br>typedef&nbsp;struct&nbsp;tagGDAERR<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;DWORD&nbsp;Code;<br>&nbsp;&nbsp;&nbsp;&nbsp;DWORD&nbsp;Qualifier;<br>&nbsp;&nbsp;&nbsp;&nbsp;} GDAERR;
 
你还有好多结构都没有呀,<br>ENUMITEM<br>GDAERR&nbsp;<br>GDASERVAR&nbsp;<br>POINTREFLIST&nbsp;,<br>这些都不是DELPHi自带的,其实GDAVALUEUNION这个结构的转换和上面那个差不多.<br>你自已试着转换一下,有什么不明白的地方,再上来问吧
 
这几个结构我可以转,就&nbsp;GDAVARIANT&nbsp;&nbsp;var<br>如果转为&nbsp;VAR:GDAVARIANT&nbsp;通不过。
 
var是DELPHI保留的关键字,建议换成其他名称
 
这个的目的在于VC中定义一个类似于VB中的VARIANT类型的参数,于按地址传递数值或文字等类型。而我现在打算用DELPHI开发。
 
&quot;就&nbsp;GDAVARIANT&nbsp;&nbsp;var<br>如果转为&nbsp;VAR:GDAVARIANT&nbsp;通不过&quot;<br>晕,VAR在这里是个变量名字,你只要按命名规则定义就好了
 
后退
顶部