views:

75

answers:

1

I'm using ShowWindow from user32.dll to show messenger style popups ( always on top, doesn't steal focus ), but I can't get them to respond. It seems that my new form is missing a messageloop, and therefore cannot draw it's controls or react to input.

I've tried to create the form in a backgroundworker, but that doesn't seem to help (form still stays unresponsive).

If I show the form with Application.Run(myForm), I get the messageloop and responding form, but no always-on-top+do-not-steal-focus functionality.

So my question is, how do I create a messageloop for my form?

+1  A: 

You might want to check out this SO post on how to show a form without stealing focus. This should help
Further down in the answers you can see:

protected override bool ShowWithoutActivation
{
   get
   {
      return true;
   }
}

Then just do form.Show() and you should get a message pump with an inactive window.

SwDevMan81
That uses ShowWindow, which doesn't give me a messageloop and the created form doesn't do anything.
Morri
I added the section form the answer that should work without ShowWindow that will give you a message pump
SwDevMan81
I also realized that I can do Application.Run() after ShowWindow to get a message pump for my form.
Morri