fsyhrb
驱动牛犊
驱动牛犊
  • 注册日期2002-03-13
  • 最后登录2005-06-08
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:905回复:1

vb问题

楼主#
更多 发布于:2004-04-03 10:29
在vb里想用windows api打开串口,可是不行大家看看什么毛病:Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long

Dim fHandle As Long

fHandle = CreateFile("COM1", GENERIC_WRITE Or GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL Or FILE_FLAG_OVERLAPPED, 0)

返回的总是错误句柄
Ymd1023
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2008-05-07
  • 粉丝0
  • 关注0
  • 积分22分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2004-04-23 13:14
Private Declare Function CreateFile Lib \"kernel32\" Alias \"CreateFileA\" (Byref 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
看行不行
YMD
游客

返回顶部