有一个用VC写的设备连接函数RCPCardOut(Handel m_hCom) m_hCom是一个串口句柄
我用DELPHI向 m_hCom赋值,应该使用什么变量类型?
大家帮我看看对不对
var
  m_hCom:THANDEL
function RCPCardOut(var m_hCom :THandle):Integer;stdcall; external 'RCPV11_VCDLL.dll ';procedure TForm1.Button3Click(Sender: TObject);
begin
  if RCPCardOut(m_hCom)=0 then showmessage('成功') else showmessage('失败');
end;

解决方案 »

  1.   

    可以用THandel类型,但是在调用这个函数前,还需调用另一个函数取得这个值勤吧。
      

  2.   

    delphi中已经把m_hCom定义成了THANDEL类型了,值也取出来了(嫌麻烦代码省略了),貌似delphi中的THANDEL类型不能直接赋值给VC中的THANDEL类型吧 求解,我上面的代码有误错误
      

  3.   

    THandle is the type for handles to operating system resources.UnitSystemDelphi syntax:type  THandle = LongWord;DescriptionTHandle is a 32-bit value that uniquely identifies a resource.
    以上是Delphi中的说明,我看没有什么不能。
      

  4.   

    RCPCardOut(Handel m_hCom),VC的是这样,那么你Delphi中的
    function RCPCardOut(var m_hCom :THandle):Integer;stdcall; external 'RCPV11_VCDLL.dll ';
    凭什么加上“var“
      

  5.   

    为什么加var我也不太明白 这是我从网上找到的方法 如果没有var的话还真是不行
    如果是delphi的DLL也是不需要var的
    function RCPCardOut(m_hCom :THandle):Integer;stdcall; external 'RCPV11_VCDLL.dll ';
    这样就可以