I'm filtering the messages that come to a form with PreFilterMessage like this:
print("code sample");
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == WM_KEYDOWN && (int)m.WParam == VK_ESCAPE)
{
this.Close();
return true;
}
return false;
}
print("code sample");
but the matter is that form closes only for the first time. After reopening a form it won't close anymore by pressing ESC.
How can I accomplish this?
Thanks