您现在所在的是:

串口通信

回帖:1个,阅读:1991 [上一页] [1] [下一页]
812
chengji
文章数:22
年度积分:50
历史总积分:812
注册时间:2001/7/12
发站内信
发表于:2001/7/12 16:29:00
#0楼

模块中申明如下:

Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long

Public Declare Function ReadFile Lib "kernel32" _
(ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, _
lpNumberOfBytesRead As Long, lpOverlapped As OVERLAPPED) As Long

Public Declare Function WriteFile Lib "kernel32" _
(ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, _
lpNumberOfBytesWritten As Long, lpOverlapped As OVERLAPPED) As Long

Public Declare Function SetCommState Lib "kernel32" _
(ByVal hCommDev As Long, lpDCB As DCB) As Long

Public Declare Function SetupComm Lib "kernel32" _
(ByVal hFile As Long, ByVal dwInQueue As Long, ByVal dwOutQueue As Long) As Long

Public Declare Function GetCommState Lib "kernel32" _
(ByVal nCid As Long, lpDCB As DCB) As Long

Public Type DCB
       DCBlength As Long
       BaudRate As Long
       fBitFields As Long 'See Comments in Win32API.Txt
       wReserved As Integer
       XonLim As Integer
       XoffLim As Integer
       ByteSize As Byte
       Parity As Byte
       StopBits As Byte
       XonChar As Byte
       XoffChar As Byte
       ErrorChar As Byte
       EofChar As Byte
       EvtChar As Byte
       wReserved1 As Integer 'Reserved; Do Not Use
End Type

Public Type OVERLAPPED
       Internal As Long
       InternalHigh As Long
       offset As Long
       OffsetHigh As Long
       hEvent As Long
End Type

Public Type SECURITY_ATTRIBUTES
       nLength As Long
       lpSecurityDescriptor As Long
       bInheritHandle As Long
End Type

窗体的LOAD中:

  Dim HCOM As Long
  Dim SECURITY_ATTRIBUTES1 As SECURITY_ATTRIBUTES
  Dim DC
-328
匿名
文章数:-150
年度积分:50
历史总积分:-328
注册时间:2001/3/12
发站内信
发表于:2001/7/12 16:36:00
#1楼
此楼内容不符合板块规定,不予显示! 查看原帖内容>>

关于我们 | 联系我们 | 广告服务 | 本站动态 | 友情链接 | 法律声明 | 非法和不良信息举报

工控网客服热线:0755-86369299
版权所有 工控网 Copyright©2024 Gkong.com, All Rights Reserved

46.8003