Connecting Tech Pros Worldwide Help | Site Map

Creating/Using a messageloop without a form

Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,148
#1: Oct 12 '09
I have been trying to access a messageloop without opening a form.
That is, I want to be able to receive messages from other applications through the message loop without having a form.

I've read that you can use Application.Run() without an argument to create a loop without a form, but I have no way of sending messages to that loop (that i have figured out)
I've tried using:
Expand|Select|Wrap|Line Numbers
  1. Application.AddMessageFilter(ft);
  2. Application.MessageLoopCallback mlc = new Application.MessageLoopCallback(mlc_target);
  3. Application.RegisterMessageLoop(mlc);
  4.  
And that messageFilter *DOES* catch a single WM_CLOSE message when I close the entire application, but I cannot seem to get any other messages through there.

I have even tried with creating a form and then hiding it (it flashes on screen, not a big deal), but it doesn't not register itself as the "MainWindowHandle" if its hidden, so I cannot use a Process call to get it.

I was just looking for a way to interact back and forth with a service (I set it to have access to the desktop or nothing worked at all) and I didn't like the custom command as it was only a one way street. (Fun for triggering things, but not much else)
I guess my real goal was to have a "front end" software to a service, that can be run without having to talk via sockets or etc.

Am I missing a fundamental communication possibility here?
Reply


Similar .NET Framework bytes