views:

45

answers:

0

Hi All,

We have a customer requirement for our WPF application: - if child modal window is minimized -> than parent (main) window should be minimized as well.

This is implemented by simple override in our base window class:

protected override void OnStateChanged(EventArgs e)
    {
        base.OnStateChanged(e);

        if (WindowState == WindowState.Minimized && Owner != null)
        {
            Owner.WindowState = WindowState.Minimized;
        }
    }

Everything works ok except for the case when we run application with elevated privileges (run as administrator in vista and win7). In this case it is not possible to restore windows (only when child modal window is minimized together with its parent) by clicking on program's icon on task bar.

Spy++ shows that the process (when "run as administrator") just does not receive any window messages when user tries to restore it.

I tried to enable all possible messages with ChangeWindowMessageFilter function (that returns without error) but with no success.

Can anyone help? Thanks in advance.