开发者

DDE: C# NDde DdeClient.Request frequently returns "No Data"?

Using NDde project (http://ndde.codeplex.com/) from C# to read data from DDE server. Frequently, the DdeClient method Request() will return "#No Data". Calling the exact same method again and the data will be returned. Why does this happen?

How to solve it? Note I tried putting the Request() call in a loop such that if no data is returned then it will retry for a given number of times. However, looping even 开发者_运维技巧10 times the data will still sometimes come back "No Data". However, if I set a breakpoint, the data will almost always be returned the second time. I'm guessing this is because there is a longer time between requests.


Why not use the Advise functionality instead of Request. To do that subscribe to the Advise event?

client.Advise += OnAdvise;

where OnAdvise is the event handler method. Then start the advise loop.

client.StartAdvise("myitem", 1, true, 60000);

Now when the data becomes available, the Advise event will fire and you will get your data from the EventArgs.


If I had to guess I would say there is probably a timing issue with the DDE server. Did you try temporal spacing between the Request operations?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜