/******************************************************************************** 
'命令01: 打开串口
'功能:打开串口,在程序调用卡机的功能函数前必须先调用
'参数说明:
char * Com:串口名称,如 "COM1","COM2"
unsigned int Baud : 通讯波特率,如:19200,38400等。
'********************************************************************************/
unsigned char _stdcall OpenCOMPort( unsigned char ComNum, unsigned int Baud );怎么转化为delphi的函数?

解决方案 »

  1.   

    function opencomport(comnum:string,baud:U32)string;
    unsigned char  对应delphi 中的string,如果是在dll中,则为pchar
    unsigned int    对应delphi 中的U32
      

  2.   

    首先这不是VB的函数,应该是c++的
    第二个,你的参数说明中串口名称为char *,下面的函数声明中为unsigned char,这个不一致如果串口名称为unsigned char
    function OpenCOMPort(ComNum:byte;Baud:integer):byte;stdcall external '你的dll名字.dll';如果串口名称为char *
    function OpenCOMPort(ComNum:pchar;Baud:integer):byte;stdcall external '你的dll名字.dll';
      

  3.   


    function OpenCOMPort( ComNum : string; Baud : integer) : string; stdcall;
      

  4.   

    搞错了~~function opencomport(comnum:pchar,baud:int)pchar; stdcall;
      

  5.   

    Com: PChar;
    Baud: Cardinal;function OpenCOMPort(ComNum: PChar; Baud: Cardinal ): Cardinal; stdcall; 弱弱的问一下,你写的是VB的函数吗?
      

  6.   

    unsigned char对应的应该是byte
    unsigned int对应的是Cardinal,不过用integer也不会出错
      

  7.   

    是vc++吧 我只会delphi 不好意思 让大家误解了