VB中:
Public Declare Function auto_init Lib "comdll.dll" (ByVal CommPort As Long, ByVal Baud As Long) As Long '打开串口
Public Declare Function ic_exit Lib "comdll.dll" (ByRef commhandle As Long) As Long '关闭串口
Public Declare Function lsct5557hex Lib "comdll.dll" (ByVal commhandle As Long, ByRef keystr As Byte) As Long请求DELPHI中调用写法?打开出宽方法我使用:
Function auto_init( CommPort : LongWord; Baud : LongWord):LongWord; STDCALL external dllname; // '打开串口可是调用时出现内存错误,请 帮忙。
Public Declare Function auto_init Lib "comdll.dll" (ByVal CommPort As Long, ByVal Baud As Long) As Long '打开串口
Public Declare Function ic_exit Lib "comdll.dll" (ByRef commhandle As Long) As Long '关闭串口
Public Declare Function lsct5557hex Lib "comdll.dll" (ByVal commhandle As Long, ByRef keystr As Byte) As Long请求DELPHI中调用写法?打开出宽方法我使用:
Function auto_init( CommPort : LongWord; Baud : LongWord):LongWord; STDCALL external dllname; // '打开串口可是调用时出现内存错误,请 帮忙。
解决方案 »
- 实施过程中遇到的通信连接问题,高分求解!请大侠赐教!
- 请教下关于多态的问题
- 如何设计这样的一个动态算法啊?
- 一个第一次学DELPHI的人,从不会到可以自己做一个管理系统大概需要多长时间?
- 实现统计表
- 《C++程序设计(谭浩强) 》电子书下不了,我用手机看的
- 请问各位GGDDJJMM谁有Delphi开发MapX,50分谢谢
- qq的聊天记录控件是什么?ListBox?RichEdit??
- 利用ADOQuery搜索学生成绩,两个DBGrid显示内容.DBGrid1显示各科成绩,DBGrid2显示不及格的课程,怎么做?
- ?没有人会吗??''假如dbgrid的第一列失去焦点'' 这句话如何用delphi语句表示---if dbgrid1.column[0].????????
- 极度郁闷,散分
- 问一个比较少见的 关于上下标存储的问题
BufferLength: Word);
var
nIndex : Integer;
boolZero : Boolean;
arrByte : array [1..8] of Byte;
strReceiveData : string;
begin
//内存移位
Move(Buffer^,arrByte,BufferLength);
strReceiveData := '';
boolZero := True;
//从高位到低位转换Buffer
for nIndex := BufferLength downto 1 do
begin
if (boolZero) and (Chr(arrByte[nIndex]) <> '0') then
boolZero := False;
if (boolZero = False) and (Chr(arrByte[nIndex]) <> '=') then
strReceiveData := strReceiveData + Chr(arrByte[nIndex]);
end;
//屏幕显示不断刷新
LCDCurrentWeight.Indicatorstring := strReceiveData;
RefreshLCD(LCDTare.Indicatorstring);
//毛重是否变化
if FboolIsEnter = False then FstrGrossWeight := strReceiveData;
end;
Function auto_init(CommPort, Baud: Longint): Longint; stdcall; external dllname; // '打开串口有没有测试过在VB中按VB的写法调用是否正确呢?
何必用DLL呢~~
Function auto_init(CommPort, Baud: Integer): Integer; stdcall;external '*.dll';
//*.dll为你的DLL文件名
串口?直接用SPCOMM得了~
何必用DLL呢~~
他的串口操作肯定被封装在comdll.dll中了,并不是他直接对串口进行操作。
奇怪奇怪啊 ~~~~~~~~~~直接操作SPCOMM是不可能的了,他的dll封装的东西可多呢。不是直接对串口操作的东西
ByVal按值,ByRef按地址