C++ 多執行緒讀取Excel技術分析
阿新 • • 發佈:2019-02-04
An MFC application uses a lot of thread local storage to store thread state
information and to process state information. Therefore, an MFC application is not compatible with a free threaded programming model. For example, if you write an application that displays a user interface (UI) and that also uses some remote Component Object
Model (COM) objects, during any method calls to the remote COM objects, the UI may stop responding. This behavior occurs because the UI thread that you initialize as an MTA thread by using the CoInitializeEx(...,
COINIT_MULTITHREADED) method makes blocking Remote Procedure Calls (RPCs) to another COM apartment. While
the UI thread waits for the RPC response message, any window messages that are posted to the queue of the UI thread are accumulated. Therefore, windows that were created by the UI thread may stop responding. This behavior may cause end users to prematurely
quit the application.