I am creating a Windows Desktop App to run on Windows 8.1 Pro.
Programmatically I can minimize it using this property:
WindowState.Minimized;
Is there a way to hide it completely instead, or disable the user to close it?
I tried with all these StackOverflow solutions but
they dont work to me.
I tried with
private const int GWL_STYLE = -16;
private const int WS_SYSMENU = 0x80000;
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
and
var hwnd = new WindowInteropHelper(this).Handle;
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
then I tried with adding the below method to my windows class
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
e.Cancel = true;
}
the I tried with this property
WindowStyle = WindowStyle.None;
still with no luck.
How can I get it?
I am using VS2015 and WPF