How can i disable closing my application by pressing alt+f4 ? I'm using the code from Mogre.Demo.ExampleApplication
The only way I can think on the top of my head would be to subclass the Window and intercept the WM_CLOSE message. Right now, if you look in OgreWindowEventUtilities.cpp, you can see that there is nothing preventing the window from closing :
for( ; start != end; ++start )
So, here is what you do :
1) Get the window handle (HWND) with RenderWindow.GetCustomAttribute("WINDOW", ...).
2) Get the current WNDPROC with GetWindowLong(...) (You will need some DllImports here)
3) Create a new WNDPROC that intercepts the WM_CLOSE message and forwards all the other messages to the old WNDPROC.
4) Use SetWindowLong() to assign your new WNDPROC.
5) There you go! The window will not close anymore. Moreover, you will have the control on what to do when a window gets closed.
If you are not familiar with Win32, let me know, I can guide you through it. Shouldnt be more than a 20-30 lines of C# code i guess.