Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Catching Photon Exit
Ref. No. QNX.000009752
Category(ies) Development
Issue We know that we can catch a PhAB program exiting because of Menu/Close, Close Button, or ALT-F4 by use of Window Closing Callback.
Is it possible to catch it in a such a way that the user can be given a second chance(e.g. Are you sure that you want to exit(Y or N)?..)?



Solution Yes, you can, and quite a few of our applications actually use it. This is the way to do it:
- make sure that Ph_WM_CLOSE is set in Pt_ARG_WINDOW_NOTIFY_FLAGS.

- turn off Pf_WM_CLOSE in Pt_ARG_WINDOW_MANAGED_FLAGS.

- attach a Pt_CB_WINDOW callback that detects a Ph_WM_CLOSE event,  pops-up the "Are you sure..." dialog, and exits if the answer is "Yes".