简体   繁体   English

我可以从STA dll运行QT或wxWidgets GUI吗?

[英]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. 我目前正在评估用于移植现有非托管C ++代码库以使用新GUI工具包的选项。 QT and wxWidgets both seem like a good fit so far as they have a strong object model. 只要具有强大的对象模型,QT和wxWidgets似乎都非常合适。 The application is only targeted at Windows machines, but a platform independent solution would be good to have. 该应用程序仅针对Windows机器,但是最好有一个独立于平台的解决方案。

In the future this code may need to be converted into a DLL restricted to a Single Threaded Apartment (STA). 将来可能需要将此代码转换为仅限于单线程单元(STA)的DLL。 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). 我知道DLL将由充当多线程单元(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. 不幸的是,此应用程序可能还正在加载其他具有自己的GUI的DLL,这些DLL可能正在使用不受我控制的其他或类似工具包。 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. 我从其他帖子中了解到可以从DLL启动QT GUI ,但不是很灵活。 However, I don't know if the same is true for wxWidgets, or if the STA restriction has any impact for either toolkit. 但是,我不知道对于wxWidgets是否同样如此,或者STA限制是否对任何一种工具包都有影响。

wxWidgets doesn't care about the apartment it's loaded into. wxWidgets不在乎它加载到的公寓。 The only COM interfaces it uses are the shell ones (eg IFileDialog ) which should work in any apartment. 它使用的唯一COM接口是外壳接口(例如IFileDialog ),可以在任何单元中使用。 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... 但是,当然,也许我只是没有足够的想象力...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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