on_exit - Not calling if engine crashes.

Posted By: Evo

on_exit - Not calling if engine crashes. - 05/15/18 05:17

I have important data that needs changed when my project exits. I'm currently dealing with the issue that if the project crashes, the on_exit function never gets called.

Is there a way to force the on_exit function if the project crashes?
Posted By: txesmi

Re: on_exit - Not calling if engine crashes. - 05/15/18 08:58

Hi,
as far as I tested, the window callback function always receive the window destroying message.

Code:
LRESULT CALLBACK onMsgOld (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

LRESULT CALLBACK myMsg (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
	if (message == WM_DESTROY) {
		// do whatwever you need at window destroying time
	}
	return onMsgOld(hwnd, message, wParam, lParam);   	  
}

void main () {
	onMsgOld = on_message;
	on_message = myMsg;
	...



Salud!
Posted By: Evo

Re: on_exit - Not calling if engine crashes. - 05/15/18 17:02

This works great.
Thanks Txesmi.
Posted By: txesmi

Re: on_exit - Not calling if engine crashes. - 05/15/18 20:40

glag of been helpful
© 2024 lite-C Forums