WumpasTamer's answer is correct. I'd just like to add a quick code sample for anyone else looking for a "turnkey" solution. If you're using WPF already then window
is not necessary, but if you're using Winforms and want to use PresentationSource
you'll need to use this.
void Main()
{
var window = new Window
{
Width = 0,
Height = 0,
WindowStyle = WindowStyle.None,
ShowInTaskbar = false,
ShowActivated = false
};
window.Loaded += a_Loaded;
window.Show();
}
void a_Loaded(object sender, EventArgs e)
{
var s = (Window) sender;
var source = PresentationSource.FromVisual(s);
//...
s.Close();
}