Alex,
I may not understand the problem correctly, but here is my plan. Instance 1 runs on a timer, say every 15 seconds (depending on your GPS card I guess). This instance grabs the port, gets what it wants then program it to release the port (this is the bit I hope is possible). Instance 2 does the same thing but if it fails to grab the port, waits 1 second then trys again. However, if the OCX doesn't allow programatically releasing and grabbing of the port you will have to go to plan B. Instance 1 grabs the port at instance startup. It grabs data from the port every 15 seconds. It writes the info out to a temp file that instance 2 can read and act upon. Erm, just some ideas. Mind you, I've jumped through all these loops with GPS cards myself, so if you have a specific application, let me know, I may be able to help but all my work has been with Delphi. Cheers Ian |
But two threads/apps cannot access the _same_ COM port - access has to be exclusive otherwise it doesn't work!
Best solution is as suggested: have an app that reads the port and then connect to that app (using files, named pipes, shared memory) to get the data. Much easier in C++!! http://bbs.scoobynet.co.uk/smile.gif |
Chaps,
Time for the Scoobynet knowledge bank to amaze me again http://bbs.scoobynet.co.uk/wink.gif http://bbs.scoobynet.co.uk/eek.gif I am trying to write an application using VB 6 that uses the standard Microsoft Comm OCX to read information from a COM Port... This app needs to run as two instances on one machine. The information, as it happens, is coming from a GPS card, though that isn't really important, it just streams NMEA (GPS Standard) text... The problem is that the OCX control, and all others I have looked at, grab the COM port exclusively, which means the second instance fails to open a connection to the COM port http://bbs.scoobynet.co.uk/mad.gif http://bbs.scoobynet.co.uk/eek.gif Anyone know how two applications can share a COM port programatically? http://bbs.scoobynet.co.uk/confused.gif http://bbs.scoobynet.co.uk/confused.gif TIA, Alex |
In almost any other language actually, it's called a non-blocking read. Still, if you use a Windows extension language ... http://bbs.scoobynet.co.uk/wink.gif
|
Can you not write three apps... one reads the com ports and then the other two apps talk to that??
Sure it can be done quite easy... What about not using the ocx but reference a dll instead... David |
Jesus what is it with C++ Programmers. http://bbs.scoobynet.co.uk/smile.gif
I do remember a headline back in the early 90's in Computer Weekly. It read something along the lines 'C Programmers make inadequate human beings' See nothings changed http://bbs.scoobynet.co.uk/biggrin.gif |
http://bbs.scoobynet.co.uk/biggrin.gif
Hey, let's start own our, totally pointless, but nonetheless vitally important, religous war over programming languages. I'll start: FORTRAN is the best http://bbs.scoobynet.co.uk/wink.gif (most of my work is with this stuff) As an aside, and the main topic of this thread, David also puts forward a valid method. Cheers Ian |
Do you know what you get if you type C++ in word , change to 72 size and the to Wingdings.
BTW VB.Net is the New Religion and you now have a Fatwah Fortran BBTW - Pascal is much better than Fortran |
All times are GMT +1. The time now is 07:48 PM. |
© 2024 MH Sub I, LLC dba Internet Brands