1

I'm writing an App Bar using win32 calls like SHAppBarMessage. Currently I handle this behavior by doing this:

SystemEvents.SessionSwitch += this.sessionSwitchEventHandler;

Where the event handler has some code:

    private void SysEventsCheck(object sender, SessionSwitchEventArgs e)
    {
        switch (e.Reason)
        {
            case SessionSwitchReason.SessionUnlock:
            case SessionSwitchReason.ConsoleConnect:
                function_to_dock_app_bar();
                break;
        }
    }

This works just fine for the SessionSwitchReason.SessionUnlock case, triggered by when the user locks their machine and then unlocks it. However, when the user chooses the Switch User option, and then logs back in later (triggering the SessionSwitchReason.ConsoleConnect case), all of the windows move around erratically and the AppBar is moved to an incorrect location.

Does anyone have insight or a workaround to this? The function that handles the docking is similar to any other win32 wpf app bar (for example)

Community
  • 1
  • 1
xandermonkey
  • 4,054
  • 2
  • 31
  • 53

0 Answers0