private const int SC_CLOSE = 0xF060;
private const int MF_ENABLED = 0x0;
private const int MF_DISABLED = 0x1;
[DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32.dll")]
private static extern int EnableMenuItem(IntPtr hMenu, int wIDEnableItem, int wEnable);
private void DisableFormClose()
{
EnableMenuItem(GetSystemMenu(this.Handle, false), SC_CLOSE, MF_DISABLED);
}
private void EnableFormClose()
{
EnableMenuItem(GetSystemMenu(this.Handle, false), SC_CLOSE, MF_ENABLED);
}
Need to add something that disables the File Close menu
September 23, 2007
Enable/Disable Form Close
This disables the system menu file close
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment