Hi George,
I suspect that the difference in behavior you're seeing is not a change in the function's semantics, but rather due to disabling the output queue (passing -1 in OpenComConfig) in your program. With the output queue enabled, the file is opened, all the bytes are read into a buffer, and the function returns, while a separate thread transfers those buffered bytes to the driver. If you are not doing any other output at the time, repeatedly calling GetOutQLen to see how much of that file data is still waiting to be transfered would give you a pretty decent progress measure. However, if you disable the output queue, the function does not buffer the bytes, but instead passes them directly to the driver. This means that when the function returns, it has already passed all the file data on to the driver.
The ComFromFile and ComToFile functions are not really designed to support a progress estimate or aborting the transfer. You could try using an output queue again, even though there are known issues in with crashes in the 8.1.x runtime engine when the output queue is enabled. Unfortunately the crash happens sometimes when calling FlushOutQ while bytes from the output queue are still being written, and I assume that this is exactly how you implement aborting the file download. I think it would probably be safe to enable the output queue if you did not allow your user to abort the file transfer. If the abort ability is important to you, then honestly, I would just do your own simple implementation of ComFromFile. Because you are just writing the whole file in binary mode, and you don't watch for a termination character, you could just open the file, read a chunk, call ComWrt on that chunk, and repeat until the entire file has been transferred. This way, you know exactly how many bytes you've written, and you can break the transfer between chunks. If you want a smooth and responsive progress bar and abort button, you would want to use a fairly small chunk size and be sure to call ProcessSystemEvents in your loop.
Hope this helps.
Mert A.
National Instruments
Message Edited by Mert A. on 07-02-2007 11:05 AM