alt-f4 disable
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
alt-f4 disable
Can I disable exiting with alt-f4 without modifying the source code? Or should I just do that and rebuild at the end of my project?
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Posts: 24
- Joined: Sun Sep 23, 2007 9:45 pm
- Location: Spain
I have similar problem with the close button of the main window.
I have modify a few the CIrrDeviceWin32.cpp:
this works and the window don't close with neither the close button or the alt+F4. I suppose I can create a new event type EGET_USER_CLOSE_WINDOW and then capture it in my application and close de window. But I don't know how to close my window my best is to call:: Device->closeDevice(); But it only close the window and not the console...
another problem is that device run allways return true....
any idea of how to close the application correctly???
I have modify a few the CIrrDeviceWin32.cpp:
Code: Select all
- /*case WM_DESTROY:
- PostQuitMessage(0);
- return 0;*/
case WM_SYSCOMMAND:
// prevent screensaver or monitor powersave mode from starting
if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
(wParam & 0xFFF0) == SC_MONITORPOWER)
return 0;
break;
case WM_USER:
event.EventType = irr::EET_USER_EVENT;
event.UserEvent.UserData1 = (irr::s32)wParam;
event.UserEvent.UserData2 = (irr::s32)lParam;
dev = getDeviceFromHWnd(hWnd);
if (dev)
dev->postEventFromUser(event);
return 0;
}
+ if (message != WM_QUIT && message != WM_CLOSE && message != WM_DESTROY){
return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ else{
+ printf("Close Device. ¿Create new event type?\n");
+ }
return 0;
}
another problem is that device run allways return true....
any idea of how to close the application correctly???
-
- Posts: 24
- Joined: Sun Sep 23, 2007 9:45 pm
- Location: Spain
Hi all.
A lot of time receiving is time to contribute...
Althoug you caught the WM_QUIT, WM_DESTROY... it don't works, when you caught this event the main windows has been already close.
Is necessary to caught a WM_SYSCOMMAND with wParam = SC_CLOSE that generate the next close events (WM_CLOSE. WM_QUIT...)
I put here my solution y never close the application with Alt+F4 Or close window button.
File CIrrDeviceWin32.cpp
Now the only way to close the application is caught EGET_MAIN_WINDOW_CLOSED and call to Device->closeDevice();
I Hope this help
A lot of time receiving is time to contribute...
Althoug you caught the WM_QUIT, WM_DESTROY... it don't works, when you caught this event the main windows has been already close.
Is necessary to caught a WM_SYSCOMMAND with wParam = SC_CLOSE that generate the next close events (WM_CLOSE. WM_QUIT...)
I put here my solution y never close the application with Alt+F4 Or close window button.
File CIrrDeviceWin32.cpp
Code: Select all
case WM_SYSCOMMAND:
// prevent screensaver or monitor powersave mode from starting
if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
(wParam & 0xFFF0) == SC_MONITORPOWER)
return 0;
+ //Event capture, close window
+ if((wParam & 0xF060) == SC_CLOSE){
+ //Generate new event type
+ event.EventType = irr::EET_GUI_EVENT;
+ event.GUIEvent.EventType = irr::gui::EGET_MAIN_WINDOW_CLOSED;
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ return 0;
+ }
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
Code: Select all
if (event.EventType == irr::EET_GUI_EVENT)
if(event.GUIEvent.EventType == irr::gui::EGET_MAIN_WINDOW_CLOSED)
Device->closeDevice();
I Hope this help
-
- Posts: 24
- Joined: Sun Sep 23, 2007 9:45 pm
- Location: Spain