
Createfile API problem with COM ports
I am developing a VB4.0-32 application that must constantly monitor a Comm Port
which is receiving a steady stream of input strings. When I set up MSComm to
input data and then do MSComm.Open, the cursor locks up. I can still use the
keyboard, but cursor operation is suspended until I do MSComm.Open = False.
This is unnacceptable because the comm operations must run in the background so
that other parts of the program can be invoked.
I thought I would try using the Win32 API, but the examples fail on the very
first API call, which for operating a Comm port is CreateFile. My declaration
looks like:
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
lpSecurityAttributes As Any, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Any) As Long
Which is pasted directly from the API Viewer. The line:
lpSecurityAttributes As Any
is modified based on a model from _VB4 API HowTo_
The original set the "AS" to a security structure. The change is
also reflected in the application in the MSDN starter kit examples.
I just spent three days crawling through documentation and the KB
looking for info on this. Found a lot of neat stuff, but nothing on the
use of CreateFile...
Does anyone have a clue?
Wan Smiles,
John