登录
首页 串口通信 串口通信
回帖 发帖
正文

主题: 模块中申明如下: Public Decl

点击:2042 回复:1


模块中申明如下:
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
01-07-12 16:29
1楼
该帖内容不符合相关规定!
01-07-12 16:36

工控新闻

更多新闻资讯