Quote Originally Posted by IanS View Post
Hi Dave - I just downloaded that and took a quick look at the code.

I haven't actually tested it yet with a slow port but would you just clarify for me - what you're saying is that (when I click the "Open Async" button) if the API CreateFile function hangs (ie does not return for any length of time) then the application will still remain responsive and can periodically check to see if the port opened yet.
Short answer is yes, but I would not "check periodically". I would set up my own timer on the form that alerts me that n seconds have gone by and I should try again later, etc. However I don't think there is much you can do besides wait for the API call to return. Like I don't think you can cancel that call or anything, you just gotta let it run its course.

Quote Originally Posted by IanS View Post
So, in theory, one could use that sample code to do practically 'anything' on an async basis.
Yes!

Quote Originally Posted by IanS View Post
You said you wrote much of that code some time ago - was that its purpose ? to do api tasks asynchronously ? Where is that code, I couldn't see it in the codebank.
I made 2 Classes many years ago that used bits of that code; One was the CountDownTimer to be used as a non-graphical Windows Timer, and the other is clsPerformanceCounter, which can be used to measure the time it takes code to execute, and is accurate down to 300 nanoseconds.