开发者

WPF application which calls an API, which needs a message pump

I have a WPF application that calls an API to operate a device (a scanner). This API is COM based, and internally has a hidden window that the scanner sends messsages too. The intent of the API is to turn those windows messages into COM events. The problem is that the WPF application doesn't have a message pump, and therefore none of the messages are being delivered to the hidden window. Therefore none of the events are fired and it looks like the scanner is not responding.

How should I create a message loop in the WPF application that will be able to dispatch messages to the 开发者_StackOverflow社区invisible window?


This method can start a message pump if you don't have one already: http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.run.aspx

Note that each thread owns a separate message pump, which pumps messages for all windows created by that thread. You need to find the thread that created the hidden window.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜