I try to write to a file(unit 50) from one thread and after the write command I do an invalidaterect to update the user interface to display the contents of the file by reading from the same file(unit 50) which happens with the main program thread(in WM_PAINT).I get run time error 40 on execution.
Runtime error 40 as you know is for:Recursive I/O operation.
FOR$IOS_RECIO_OPE. While processing an I/O statement for a logical unit, another I/O operation on the same logical unit was attempted, such as a function subprogram that performs I/O to the same logical unit that was referenced in an expression in an I/O list or variable format expression.
I tried giving a suitable delay after the write before the call to invalidaterect, but this didn't work.Can someone suggest a way to solve this problem. Thanks