0

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?

Morri
  • 571
  • 5
  • 20
  • For now, I'll go with Application.DoEvents. It isn't the most elegant solution, but atm the only thing I can think of. – Morri Dec 17 '09 at 09:15

1 Answers1

1

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.

Community
  • 1
  • 1
SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
  • That uses ShowWindow, which doesn't give me a messageloop and the created form doesn't do anything. – Morri Dec 17 '09 at 06:03
  • I added the section form the answer that should work without ShowWindow that will give you a message pump – SwDevMan81 Dec 17 '09 at 13:25
  • I also realized that I can do Application.Run() after ShowWindow to get a message pump for my form. – Morri Dec 18 '09 at 11:00