Morri
Morri

Reputation: 581

ShowWindow and messageloop

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?

Upvotes: 0

Views: 496

Answers (1)

SwDevMan81
SwDevMan81

Reputation: 49978

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.

Upvotes: 1

Related Questions