Thanks for the reply I tried the following code:
IntPtr hwd = GetConsoleWindow();
if (hwd != IntPtr.Zero)
{
EnableMenuItem(GetSystemMenu(hwd, false),
SC_CLOSE, MF_BYCOMMAND | MF_DISABLED);
}
It seems EnableMenuItem works absolutely fine with forms .For Forms it
disables the cancel buton and also the Alt+F4 option.But when i use it for
console it doesnot.
Am I missing something here ?
--
Neeta
Programmer Analysts
"Mr. Arnold" wrote:
>
"Neeta" <Ne***@discussions.microsoft.comwrote in message
news:1D**********************************@microsof t.com...
Hi,
I creating a console application.
In that I want to catch the cancel event of the console application
.Please
guide me in this.I figured out that I will have to attach event to the
console.How can I do that?
The only thing you may be able to do is disable the Close button. That way,
the user has to press an exit key that you check for in code or the user has
to go to Task Manager to kill the Console application.
http://www.codeproject.com/tips/disableClose.asp