unsigned long comlpt_send(unsigned long handle, unsigned char * buf, unsigned long dwSize);/*
comlpt_read 从通信口接收数据
返回值 : 成功接收的实际字节数 参数如下:
handle : 由 comlpt_init 获得的返回值
buf : 数据空间指针首地址
dwSize : 数据空间实际字节数
*/
上面的函数,用vb怎么传直?关键是 buf 这个变量
comlpt_read 从通信口接收数据
返回值 : 成功接收的实际字节数 参数如下:
handle : 由 comlpt_init 获得的返回值
buf : 数据空间指针首地址
dwSize : 数据空间实际字节数
*/
上面的函数,用vb怎么传直?关键是 buf 这个变量
先引用api
Declare Function comlpt_send lib "ComLpt.dll"(byval handle as long,byref buf as Byte,byval dwSize as integer) as integer 再调用
private sub command1_click()
dim buu() as byte dim str as string
str="测试数据"
buu=StrConv(str,vbFromUnicode)
comlpt_send(ihandle,buu,4)
end sub
private sub command1_click()
dim buu() as bytedim str as string
str="测试数据"
buu=StrConv(str,vbFromUnicode)
comlpt_send(ihandle,buf(0),4)end sub
comlpt_send(ihandle,buf(0),lenb(buf))
dim i as inter
buu=StrConv(str,vbFromUnicode)
i=lenb(buu)'这里报错,说 要求变量-不能赋值到该表达试
comlpt_send(ihandle,buf(0),i)