简体   繁体   中英

Can I run a QT or wxWidgets GUI from a STA dll?

I am currently evaluating options for porting an existing unmanaged C++ codebase to use a new GUI toolkit. QT and wxWidgets both seem like a good fit so far as they have a strong object model. The application is only targeted at Windows machines, but a platform independent solution would be good to have.

In the future this code may need to be converted into a DLL restricted to a Single Threaded Apartment (STA). Is this a un-avoidable problem for either of these toolkits? Are there any other toolkits that I should be considering?

I know the DLL would be loaded by an application acting as a Multi Threaded Apartment (MTA). Unfortunatly, this application may also be loading other DLLs that may have their own GUIs which could be using other or similar toolkits not under my control. Are either of these toolkits more suited to these restrictions? I understand from other posts that starting a QT GUI from a DLL is possible, but not very flexible. However, I don't know if the same is true for wxWidgets, or if the STA restriction has any impact for either toolkit.

wxWidgets doesn't care about the apartment it's loaded into. The only COM interfaces it uses are the shell ones (eg IFileDialog ) which should work in any apartment. So I just can't imagine having any new problems due to this. But maybe I just don't have a good enough imagination, of course...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM