Applications should not perform any kind of synchronous I/O on a UI thread (the threads that service WNDPROC callbacks and have a message dispatching loop). The reason is that an application does not know when environmental conditions may lead these APIs to become unresponsive, such as a bad hard drive or a slow network connection. However, in practice, a lot of code gets away with the behavior. It may be impractical to develop an architecture to account for a situation that has a low probability of hanging (such as reading from a local, fixed hard drive).
In Windows Vista and Windows 7, we collected a great deal of data on which APIs are the largest culprits in causing hangs based on device I/O. The following list are the APIs that contribute most frequently to hangs in Device I/O. While this list is heavily influenced by the choices of developers whose applications end up in the data, it is still a good indication of which APIs to avoid on your UI thread:
Although this list is not exhaustive, it does represent APIs that are among the largest contributors to hangs on the UI thread. Avoid using them from within your WNDPROC!