Solved

COM port using API

Posted on 1998-11-11
3
306 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
Comment Utility
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
Comment Utility
Could u please let me know how to use them.
Thanks in Advance
-Raju
0
 
LVL 2

Expert Comment

by:jrmcg
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now