Message pump in .NET Windows service
Posted
by Pickles
on Stack Overflow
See other posts from Stack Overflow
or by Pickles
Published on 2010-03-14T21:33:37Z
Indexed on
2010/03/16
19:41 UTC
Read the original article
Hit count: 385
I have a Windows Service written in C# that handles all of our external hardware I/O for a kiosk application. One of our new devices is a USB device that comes with an API in a native DLL. I have a proper P/Invoke wrapper class created. However, this API must be initialized with an HWnd to a windows application because it uses the message pump to raise asynchronous events.
Besides putting in a request to the hardware manufacturer to provide us with an API that does not depend on a Windows message pump, is there any way to manually instantiate a message pump in a new thread in my Windows Service that I can pass into this API? Do I actually have to create a full Application class, or is there a lower level .NET class that encapsulates a message pump?
© Stack Overflow or respective owner