I have two pieces of Windows technology which I'd like to plumb together: a TSP (a TAPI service provider) and an API wrapped around some hardware. The API accepts requests synchronously but returns success/fail/status result asynchronously by sending messages to a passed-down HWND.
As I understand it, the problem is that because a TSP runs as a Windows service, its execution context doesn't have access to most interactive Windows functions. So, much as I'd like to directly link the two together, I can't - a开发者_JAVA技巧s far as I can tell, the TSP doesn't (and indeed couldn't) have an HWND for the API to send messages to. :-(
For someone like me who has only ever programmed Windows stuff on one side of the service/interactive line at a time, all of this is a bit of a head-scratcher. But Windows being the way it is, there must be several sensible ways of getting messages across this line, surely?
How would you advise me to try to hook up these two things? Thanks! :-)
A service can create a "message window" (a window whos parent is HWND_MESSAGE) and run a message pump. A message window has no UI and therefore doesn't interact with the desktop.
I would suggest using MSMQ to pass messages between the two different applications. I can be a little cumbersome but it would work.
Your service could create a named file mapping object in the Global
object namespace, and then your interactive program could then open that file mapping. You could then communicate via shared memory.
精彩评论