Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

COM port using API

Posted on 1998-11-11
3
Medium Priority
?
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
jrmcg earned 200 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

636 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