forcing parent window's title bar to remain active

  • Thread starter Thread starter rory.groves
  • Start date Start date
R

rory.groves

I would like to force the parent window's title bar to paint as Active
when a tool window is active.

Here is my code:

public const int WM_NCACTIVATE = 0x086;

protected override void WndProc(ref
System.Windows.Forms.Message m)
{
if (m.Msg == WM_NCACTIVATE)
{
if (m.WParam == IntPtr.Zero)
{
InteropUtility.SendMessageW(this.Handle,
WM_NCACTIVATE,
new IntPtr(1), IntPtr.Zero);

return;
}
}
base.WndProc(ref m);
}


So far, i have only been able to achieve the following results:

a) parent window stays active (though painting in W2K style with no XP
theme) but child window _never becomes active_ and therefore is
unusable

b) child window can be made active but parent window always reverts to
Inactive
 
I would like to force the parent window's title bar to paint as Active
when a tool window is active.

You're fighting the OS; if the tool window is active, then the parent
*isn't* active.

What is it you actually want to do here? For instance, it sounds like
you might want "parent.AddOwnedWindow(child);" or similar; this allows
the two forms to show non-modally (i.e. both can be used), but the OS
treats them as a single entity with regards to focus, minimise, etc
(typical for "find" dialogs, etc).

Marc
 
Thanks for the response.

Take a look at any graphics editors (PhotoShop, Paint.Net). They allow
both tool windows and parent windows to appear "activated".

Paint.Net is entirely written in c#, so i know its possible.

Alreading using the "Owner" property, but it still deactivates the
parent window.
 
Back
Top