小编Tom*_*ter的帖子

在使用线程池获得.Net应用程序的渲染层后,为什么我的DDE调用会挂起?

我发现了一个非常奇怪的问题,如果我使用ThreadPool获取.Net应用程序的渲染层,它将从Excel挂起一个非常简单的DDE调用.在与Excel的DDE调用同时运行复杂的WPF应用程序时,会出现此问题.我已经设法在几行代码中重现了这个问题,可以在下面找到.

C#.Net App

//Need to reference PresentationCore.dll
class Program
{
    private static int _renderTier;
    static void Main(string[] args)
    {
        ThreadPool.QueueUserWorkItem(x =>
                                         {
                                             _renderTier = RenderCapability.Tier;
                                             Console.WriteLine(_renderTier);
                                         });
        Console.ReadLine();
    }
}
Run Code Online (Sandbox Code Playgroud)

Excel DDE宏.

Sub Using_DDE1()

  ' Dimension the variables.
  Dim Chan As Integer
  Dim RequestItems As Variant

  ' Start a channel to Word using the System topic.
  Chan = DDEInitiate("WinWord", "System")

  ' Requesting information from Word using the Formats item
  ' this will return a one dimensional array.
  RequestItems = DDERequest(Chan, …
Run Code Online (Sandbox Code Playgroud)

.net wpf excel dde

5
推荐指数
1
解决办法
2060
查看次数

标签 统计

.net ×1

dde ×1

excel ×1

wpf ×1