GUI Dialog on a separate thread

0

are there any objects when running wxWidget's common dialogs on a separate thread? I'm developing a browser plugin and so I need to put lengthy operations outside the main browser thread.

I did a small test and it seems to work but a warning appears:

....\src\msw\dirdlg.cpp(333): 'CoCreateInstance(CLSID_FileOpenDialog)' failed with error 0x800401f0 (coInitialize has not been called.).

Does that mean I have to call wxApp::Initialize(...) or some other functions?

Thanks, Christian

wxwidgets
asked on Stack Overflow Sep 23, 2012 by chhenning

2 Answers

1

You just need to call CoInitialize() in each thread where you are using COM. So before creating common dialog objects just call CoInitialize() (one per thread) and in the end of thread call CoUninitialize().

For main thread wxWidgets does this internally. For other threads you'll need to call these functions manually. It is generally not related to GUI but related to COM objects which wxWidgets uses internally.

answered on Stack Overflow Sep 24, 2012 by T-Rex
1

Yes, there are 'objections'

Important notes for multithreaded applications

When writing a multi-threaded application, it is strongly recommended that no secondary threads call GUI functions.

http://docs.wxwidgets.org/trunk/overview_thread.html

answered on Stack Overflow Sep 24, 2012 by ravenspoint

User contributions licensed under CC BY-SA 3.0