需要转换一段VB的代码(100分)

  • 主题发起人 主题发起人 笨笨
  • 开始时间 开始时间

笨笨

Unregistered / Unconfirmed
GUEST, unregistred user!
我有一段VB的声明代码,我将其转换成Delphi,不知道哪里错了,请各位懂得VB的帮帮忙<br>VB代码如下:<br>Declare Function rf3OpenComm Lib "rf3read.dll" (ByVal comm As Byte, ByRef hComm As Long) As Boolean<br>Declare Function rf3CloseComm Lib "rf3read.dll" (ByVal hComm As Long) As Boolean<br>我转换的如下:<br>&nbsp; function rf3OpenComm(comm : Byte; Var hComm : DWord):Bool;external 'rf3read.dll';<br>&nbsp; function rf3CloseComm (Var hComm : DWord):Bool;external 'rf3read.dll';<br>其实这是个打开串口的操作,hComm是个句柄,用VB能打开串口,但是我改写的Delphi就不行,<br>我估计是我写的有错误。
 
DWord 换成Thandle 呢
 
不行,错误如下:<br>Accessviolation at address 00E637B0.Write of address 004273BE<br>
 
unit xxxx;<br>interface<br>function rf3OpenComm (Comm:Byte;var hComm:DWORD):Boolean;stdcall;<br>function rf3CloseComm(hComm:DWORD):Boolean;stdcall;<br><br>implementation<br>function rf3OpenComm:Boolean; external 'rf3read.dll';<br>function rf3CloseComm:Boolean;external 'rf3read.dll';<br>end.<br>
 
Declare Function rf3ReadIC Lib "rf3read.dll" (ByVal hComm As Long, ByRef aData() As Byte, ByRef nCount As Byte, ByRef nType As Byte) As Long<br>翻译成delphi如下:<br>function rf3ReadIC(hComm:DWord;Var aData : Array of Byte;Var nCount:Byte;Var nType:Byte):DWord;stdCall;<br>对否?有没有遇到过oleaut32.dll出错的问题,错误如下:<br>Access violation at address 779D910A in module 'oleaut32.dll'.Read of address 00140000<br>我不知道是我写错了还是我的dll有问题,请指教
 
接受答案了.
 

Similar threads

I
回复
0
查看
596
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
759
import
I
后退
顶部