求助 vb函数装化为delphi

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

怎么转化为delphi的函数?
...全文
125 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
tony5566 2009-08-01
  • 打赏
  • 举报
回复
是vc++吧 我只会delphi 不好意思 让大家误解了
SuperTitan001 2009-08-01
  • 打赏
  • 举报
回复
unsigned char对应的应该是byte
unsigned int对应的是Cardinal,不过用integer也不会出错
kampan 2009-08-01
  • 打赏
  • 举报
回复
Com: PChar;
Baud: Cardinal;

function OpenCOMPort(ComNum: PChar; Baud: Cardinal ): Cardinal; stdcall;

弱弱的问一下,你写的是VB的函数吗?
de410 2009-08-01
  • 打赏
  • 举报
回复
搞错了~~

function opencomport(comnum:pchar,baud:int)pchar; stdcall;
caixiaobai08 2009-08-01
  • 打赏
  • 举报
回复

function OpenCOMPort( ComNum : string; Baud : integer) : string; stdcall;
SuperTitan001 2009-08-01
  • 打赏
  • 举报
回复
首先这不是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';
de410 2009-08-01
  • 打赏
  • 举报
回复
function opencomport(comnum:string,baud:U32)string;


unsigned char 对应delphi 中的string,如果是在dll中,则为pchar
unsigned int 对应delphi 中的U32

2,498

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧