我有一个调用WPF4.0DLL的VB6可执行文件。
在我的WPF dll中,我有一个后台工作程序需要更新UI。
我似乎无法返回到UI线程,因为Application.Current为空。
Application app = Application.Current;
if (app != null)
{
Dispatcher disp = app.Dispatcher;
if (disp != null)
{
if (!disp.CheckAccess())
{
}
else
{
}
}
}我也尝试过Dispatcher.CurrentDispatcher,但这也不能将我切换到UI线程。
有人知道如何在VB6 exe调用WPF dll时切换到WPF中的UI线程吗?
发布于 2012-10-24 08:16:55
在进入WPF端时存储Dispatcher.CurrentDispatcher,以便您可以从BackgroundWorker使用它。
https://stackoverflow.com/questions/13021769
复制相似问题