Synchronise Events

azwaan
05-28-2003, 07:24 AM
i have a application which reads data from the com port through the use of MSCOMM control and send it to a text file.

i periodically (with a Timer Control) check the text file, process the raw data and send it to a database.

the problem , is occasionaly there is an error "File already Open" , i am fairly certain , this is because, i am trying to dump data into the text file, when i already have it open to process the data.

is there a way to synchronoise both these events ..ie "MSCOMM_ONCOMM event " and the TIMER_Timer Event so, that this does not happen.

DrPunk
05-30-2003, 03:11 AM
I don't think that the question you've asked is the answer that you are looking for. It's more about the structure of your program.

Does the timer kick off the whole process? i.e. every x seconds attempt to talk over comms and if talk then write stuff to file.

azwaan
05-30-2003, 05:40 AM
I don't think that the question you've asked is the answer that you are looking for. It's more about the structure of your program.

Does the timer kick off the whole process? i.e. every x seconds attempt to talk over comms and if talk then write stuff to file.


thanks for replying.

the data is written onto the text file, when the MSCOMM_OMCOMM event is triggered..which happens when new data arrives at the com port.

processing occurs every 10 seconds through the use of the TIMER control, so i have no control, over when i actually dump the data.

so. sometimes both the events happen simultaneously..

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum