Trying to create a WPF caliburn micro application that creates a separate desktop and shows its main window there.
Problem: after the desktop is created and i switch there, no window is shown.
namespace WpfThreads
{
class AppBootstrapper : Bootstrapper<WpfThreads.ViewModels.WpfThreadsViewModel>
{
protected override void OnStartup(object sender, StartupEventArgs e)
{
var desktop = Native.CreateDesktop("NewDesktop", 0, 0, 0, DESKTOP_READOBJECTS | DESKTOP_CREATEWINDOW | DESKTOP_CREATEMENU | DESKTOP_HOOKCONTROL | DESKTOP_JOURNALRECORD | DESKTOP_JOURNALPLAYBACK | DESKTOP_ENUMERATE | DESKTOP_WRITEOBJECTS | DESKTOP_SWITCHDESKTOP, 0);
Native.SetThreadDesktop(desktop);
Native.SwitchDesktop(desktop);
base.OnStartup(sender, e);
}
}
}
SetThreadDesktop() fails, other calls are successful. The OnStartup() method does run on main thread (which is also the UI thread).