请高人帮我看看下面的程序: Public Type SECURITY_ATTRIBUTES nLength As Long lpSecurityDescriptor As Long bInheritHandle As Long End Type 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 LongPublic 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 Sub main() Dim ck As String Dim lResult As Long Dim lHandle As Long Dim DCB_COMM As DCBlHandle = CreateFile("com1", GENERIC_WRITE, 0, Null, OPEN_EXISTING, 0, 0) Debug.Print lHandleEnd Sub当程序运行到“lHandle = CreateFile("com1", GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0)”时,提示“Byref参数类型不符”是什么原因?
我正在做一个串口程序,用的是MSCOMM 控件
lHandle = CreateFile("com1", GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0)
提示“Byref参数类型不符”是什么原因?
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
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 LongPublic 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
Sub main()
Dim ck As String
Dim lResult As Long
Dim lHandle As Long
Dim DCB_COMM As DCBlHandle = CreateFile("com1", GENERIC_WRITE, 0, Null, OPEN_EXISTING, 0, 0)
Debug.Print lHandleEnd Sub当程序运行到“lHandle = CreateFile("com1", GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0)”时,提示“Byref参数类型不符”是什么原因?