开发者

What happends to opened DDE Channels if the application that opened them crashed?

I'm adding DDE for my app (C# 3.5) and sometimes when I open thousands (6000) of DDE channels it works, and sometimes, espec开发者_StackOverflow中文版ially during debugging and excel crashes, it only gives me some of the items.

I suspect that the DDE channels are still "active" in Windows and when I try to open more I reach the DDE channels limit (10,000) and then not all have data.

Is there a way to "clean" the DDE engine in Windows, so I'll start fresh? or is restarting Windows the only solution?


If you're using the open source NDde (http://ndde.codeplex.com/) then you can use the DdeClient class which implements the IDisposable pattern. Then use the client inside a using block. This effectively creates a finally block which should close the connection if an exception is thrown. E.g.,

using (DdeClient client = new DdeClient(DDE_SERVER_NAME, dataField))
{
    client.Connect();

    string data = client.Request("xyz", DDE_TIMEOUT);
}

However, I've experienced the same thing though with data not being consistently returned but I not opening thousands of connections so it may be a different issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜