Execute code Before ALT+F4

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Jake007
Posts: 16
Joined: Wed Jun 29, 2011 8:39 pm
Location: Slovenia

Execute code Before ALT+F4

Post by Jake007 »

Hi!

Is it possible to execute some code before ALT + F4?

Irrlicht can't detect ALT key as I found out here -> http://irrlicht.sourceforge.net/forum/v ... =7&t=40253 ( if it can please let me know), so I can't simply use if statement.

Regards,
Jake
HerrAlmanack
Posts: 52
Joined: Mon Jun 13, 2011 3:50 pm

Re: Execute code Before ALT+F4

Post by HerrAlmanack »

well afaik alt-4 (in windows) sends the message to close the windows app, and irrlicht would be that receiver. i think it just closes the irrlicht device by setting the run() return value to false. i don't see why you couldn't just put that code after the engine while() drawing loop.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: Execute code Before ALT+F4

Post by Radikalizm »

HerrAlmanack wrote:well afaik alt-4 (in windows) sends the message to close the windows app, and irrlicht would be that receiver. i think it just closes the irrlicht device by setting the run() return value to false. i don't see why you couldn't just put that code after the engine while() drawing loop.
In windows, Alt+F4 sends a WM_CLOSE message to your window messaging loop, irrlicht itself barely has anything to do with it (I'm not sure how this works in Linux, but I assume it's something similar)

You'd have to catch the WM_CLOSE message before the messaging loop does to be able to execute code before it actually closes the window
Jake007
Posts: 16
Joined: Wed Jun 29, 2011 8:39 pm
Location: Slovenia

Re: Execute code Before ALT+F4

Post by Jake007 »

Thanks. I'll try HerrAlamnack's suggestion. Otherwise, I've already came up with alternative. Not so precise, but I it should do.
Post Reply