Solved

MSComm Timeout

Posted on 2003-12-02
5
921 Views
Last Modified: 2008-02-01
Hi.

I have an VBA application that talks to a serial device, which acts as a converter and talks to another device. I would like a way for the application to timeout if it doesn't recieve a response in a certain period of time.

The trouble with the timeouts built in to mscomm (that I know of) is that they will only detect if the serial device is there when the app is transmitting, but I need to know if the third device is not responding.

Thanks and sorry if I wasn't clear enough.
0
Comment
Question by:Dormouse31
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
mazfar earned 125 total points
Comment Utility
I dont know if it answers your question but its a kind of work around.

Put a timer control and set it to whatever is your max waiting time at the port. Whenever you do a serial port open, activate the timer. When the specified interval passes, the timer event will fire and you can close the port (or do whatever u want to here). In the MSCOMM oncomm event, reset the counter (so as whenever you receive anything timer starts again).

I hope I was able to explain my solution.

Ciao
0
 

Author Comment

by:Dormouse31
Comment Utility
I thought of the timer idea, but there isn't a timer in the VBA toolbox. How do you use a timer in a VBA App?
0
 
LVL 1

Expert Comment

by:mazfar
Comment Utility
Check this link to use timer API to replicate timer functionality in VBA.

http://www.developerfusion.com/show/1090/

Have a nice day.
0
 
LVL 29

Expert Comment

by:leonstryker
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered mazfar
 
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

leonstryker
EE Cleanup Volunteer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

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

8 Experts available now in Live!

Get 1:1 Help Now