100分請幫助我把vb的這段程序改為delphi,急急急急急急。。謝謝(100分)

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

lzl200188

Unregistered / Unconfirmed
GUEST, unregistred user!
多謝大家幫助﹐100分<br>Declare Function OpenCfgComm Lib "WY2000" (ByVal port As Integer, ByVal setting As String) As Long<br>Declare Sub CloseCfgComm Lib "WY2000" (ByVal h As Long)<br>Declare Function SendCfgData Lib "WY2000" (ByVal h As Long, SendData As gSendR, ByVal nCount As Integer, ByVal hAddr As Byte, ByVal Style As Byte) As Integer<br>Declare Function ReadCfgData Lib "WY2000" (ByVal h As Long, GetD As gReadR, ByVal hAddr As Byte, ByVal Style As Byte) As Integer<br>Declare Function ReadCfgDataToFile Lib "WY2000" (ByVal h As Long, ByVal GetD As String, ByVal hAddr As Byte, ByVal Style As Byte) As Integer<br>Declare Function ReadCfgStatus Lib "WY2000" (ByVal h As Long, ByVal hAddr As Byte) As Byte<br>Declare Function ReadCfgNo Lib "WY2000" (ByVal h As Long, CN As Long, ByVal hAddr As Byte) As Byte<br>Declare Function InitCfg Lib "WY2000" (ByVal h As Long, ByVal CfgNo As Byte) As Boolean<br>Declare Function ReadNo Lib "WY2000" (ByVal h As Long, pData As Byte) As Byte<br>Declare Function WriteNo Lib "WY2000" (ByVal h As Long, pData As Byte, ByVal CardStyle As Byte) As Byte<br>Declare Function WriteEnd Lib "WY2000" (ByVal h As Long, pData As Byte, ByVal CardStyle As Byte) As Byte<br>Declare Function WritePwd Lib "WY2000" (ByVal h As Long, pData As Byte, ByVal CardStyle As Byte) As Byte<br>Declare Function ReadICStatus Lib "WY2000" (ByVal h As Long) As Byte<br>Declare Function ClearData Lib "WY2000" (ByVal h As Long, ByVal hAddr As Byte) As Boolean<br>
 
interface部分定义:<br>Function ClearData (h:long;hAddr:Byte):Bool;stdcall;<br>在implementation部分:<br>Function ClearData;external 'WY2000.dll' Name 'ClearData';<br><br>小弟初学,写的不对之处请多多指教!!!!<br>
 
function OpenCfgComm(var port : integer; var Setting : String):Cardinal;stdcall; external 'WY2000.dll';<br>procedure CloseCfgComm(var h : Cardinal);stdcall; external 'WY2000.dll';<br>function SendCfgData(var h : Cardinal;SendData : gSendR; var nCount :Integer;<br>&nbsp; var hAddr:shortInt; var style :shortInt):Intger;stdcall; external 'WY2000.dll';<br>function ReadCfgData(var h : Cardinal;Getd:gReadR;var hAddr:shortInt):Integer;stdcall; external 'WY2000.dll';<br>太累了。。 我屈服了<br>上面原码应当是 调用 dll 库中的函数 转换原则应当是如下<br>declare Function --&gt; function<br>declare Sub &nbsp; &nbsp; &nbsp;--&gt; procedure<br>ByVal &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; var<br>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt; ;<br>As &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&gt; :<br>lib "WY2000" &nbsp; &nbsp; --&gt; stdcall; external 'WY2000.dll'; 并移到函数尾<br>自己转换吧 &nbsp;^_^<br>&nbsp; &nbsp;
 
to wvy:<br>ByVal是传值,不能加var;相反,没有声明的参数默认为按地址传送,要加上var声明<br>Basic和Pascal默认的参数传递方式不同。
 
后退
顶部