Prevent A Form From Getting Focus

hoverctafter

Member
Joined
May 15, 2005
Messages
9
Programming Experience
10+
OK hopefully this is somewhat simple. I found a way to do it through API in VB6 but hope there is a better way in VB.NET. I have a control that inherits the form class which works as one of those little notification popups like in Yahoo or MSN. It works really good except for sometimes it gains focus. The main program (form) runs in the tray, but if a notification is called then it pops this up over all other windows.

Now the problem like I said is sometimes it gains focus. It is not a constant thing, so my question is - what would be the best way to ensure this control form never recieves focus but stays top most?

Any help would be appreciated...thanks!
 
suddenelfilio said:
how not to gain focus I can't help you with, but to keep it topmost you should set the property TopMost of the form to True

Thanks, I got that part in there. Right now I am using the ShowWindow api method of calling it. Only problem is after awhile of running it then it no longer works (passing the constant of 4 which is to show with out focus will show the window but also ends up giving it focus).

Its one of those problems that are so small yet so annoying.
 
Back
Top