Createfile API problem with COM ports 
Author Message
 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,

Mon, 08 Mar 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. CreateFile,ReadFile,WriteFile using COM ports and API

2. Read COM (serial) port using CreateFile?

3. Createfile to Open a Com port or Disk Drive

4. Createfile to Open a Com port or Disk Drive

5. Finding COM Ports - Mouse dies when VB talks to its COM Port

6. CreateFile API problem

7. Looking for Example using API for COM-Port in Access 97

8. COM port access from VBA via the Win32 API - error code 87

9. Q: COM port API Calls

10. API Call to get Com Ports Available.

11. API to open/close com port?

12. Any API for Com Port?


Powered by phpBB® Forum Software