From: Andrei Nehay on
Hi all,

The MFC class CFileDialog is used allowing the user to select a file. The
problem is that "My Computer" does not show anything. The local drives are
not available and can not be seen.

"My Computer" works fine ONLY if a call to CoInitializeEx() was made in a
single-threaded apartment (STA). This function initializes the Component
Object Model (COM) for use by the current thread.
MSDN does not include any remarks concerning this.
The general problem is that this thread should initialize the COM in a
multithread apartment (MTA).

Any ideas?



From: Sheng Jiang[MVP] on
If your thread has to be in MTA, Create another STA thread to call shell
functions.
Reference
INFO: Calling Shell Functions and Interfaces from a Multithreaded Apartment
http://support.microsoft.com/kb/287087

--
Sheng Jiang
Microsoft MVP in VC++
"Andrei Nehay" <AndreiNehay(a)discussions.microsoft.com> wrote in message
news:037F38DD-C592-4300-9E86-870DD17BFB47(a)microsoft.com...
> Hi all,
>
> The MFC class CFileDialog is used allowing the user to select a file. The
> problem is that "My Computer" does not show anything. The local drives are
> not available and can not be seen.
>
> "My Computer" works fine ONLY if a call to CoInitializeEx() was made in a
> single-threaded apartment (STA). This function initializes the Component
> Object Model (COM) for use by the current thread.
> MSDN does not include any remarks concerning this.
> The general problem is that this thread should initialize the COM in a
> multithread apartment (MTA).
>
> Any ideas?
>
>
>