Solved

COM port using API

Posted on 1998-11-11
3
322 Views
Last Modified: 2008-03-04
I would like to communicate with a instrument through the COM port without having to use the MSCOMM control. Is there a way to do this in VB5. A list of API calls that might be relevant would be appreciated. Thanks.
0
Comment
Question by:niraj070598
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
jrmcg earned 50 total points
ID: 1444327
This was taken from an example called VBCOMDEM used in VB 3.0 I found at microsoft's web site.  I have used these myself and they work fine.

Let me know if you have any problems.

J.R.

'COM related Windows API function declarations

Declare Function OpenComm Lib "user" (ByVal lpComName As String, ByVal wInQueue As Integer, ByVal wOutQueue As Integer) As Integer
Declare Function CloseComm Lib "user" (ByVal nCid As Integer) As Integer

Declare Function WriteComm Lib "user" (ByVal nCid As Integer, ByVal lpBuf As String, ByVal nSize As Integer) As Integer
Declare Function ReadComm Lib "user" (ByVal nCid As Integer, ByVal lpBuf As String, ByVal nSize As Integer) As Integer

Declare Function GetCommEventMask Lib "user" (ByVal nCid As Integer, ByVal nEvtMask As Integer) As Integer
Declare Function SetCommEventMask Lib "user" (ByVal nCid As Integer, ByVal nEvtMask As Integer) As Integer

Declare Function SetCommState Lib "user" (DCB As CommStateDCB) As Integer
Declare Function GetCommState Lib "user" (ByVal nCid As Integer, DCB As CommStateDCB) As Integer

Declare Function GetCommError Lib "user" (ByVal nCid As Integer, lpStat As COMSTAT) As Integer
Declare Function FlushComm Lib "user" (ByVal nCid As Integer, ByVal nQueue As Integer) As Integer

0
 

Expert Comment

by:kbalaraju
ID: 2191957
Could u please let me know how to use them.
Thanks in Advance
-Raju
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 2192297
niraj asked this question a year ago.  If you would like to know how to use these you should post a question and someone can answer it for you.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question