With Dialog System I have the possibility to continue the program if the operator used the event WINDOW-CLOSED in order to execute some closing procedures before the program stops.
What can I do when I use a Text Window (Character based) to do the same? If the operator clicks on the X the program stops immediately what I do not want. And when I remove the Sys-Menu with the WINAPI WS-SYSMENU the operator has not the possibility to change the window, minimize it, etc.,
I am looking for a simple possibility just to activate a flag if he uses X and with
IF WINDOWCLOSED GO TO CLOSING-PROCEDURE. Continue my program.
Thanks for any help
Rolf
#WINDOWCLOSEDI would believe the easiest would be to use a MF exit handler set thru the MF API cbl_exit_proc ...
:) Yvon
With Dialog System I have the possibility to continue the program if the operator used the event WINDOW-CLOSED in order to execute some closing procedures before the program stops.
What can I do when I use a Text Window (Character based) to do the same? If the operator clicks on the X the program stops immediately what I do not want. And when I remove the Sys-Menu with the WINAPI WS-SYSMENU the operator has not the possibility to change the window, minimize it, etc.,
I am looking for a simple possibility just to activate a flag if he uses X and with
IF WINDOWCLOSED GO TO CLOSING-PROCEDURE. Continue my program.
Thanks for any help
Rolf
#WINDOWCLOSEDHi rolf,
You might want to disable only the close button instead of the whole system menu, and you may achieve this by using the Windows API functions GetSystemMenu and EnableMenuItem as shown below:
*>get handle of text window
call "PC_WIN_HANDLE"
using by reference ws-textwin-handle
*>get handle of window menu
move isFalse to ws-BOOL
call win32 "GetSystemMenu" using
by value ws-textwin-handle
by value ws-BOOL
returning ws-HMENU
if ws-HMENU = 0
display "GetSystemMenu failed"
stop run
end-if
*>disable close button only
move SC-CLOSE to uIDEnableItem
add MF-BYCOMMAND to MF-GRAYED giving uEnable
call win32 "EnableMenuItem" using
by value ws-HMENU
by value uIDEnableItem
by value uEnable
returning retlong
if retlong not = 0
display "EnableMenuItem failed"
stop run
end-if
See attached for a complete demo.
Regards,
With Dialog System I have the possibility to continue the program if the operator used the event WINDOW-CLOSED in order to execute some closing procedures before the program stops.
What can I do when I use a Text Window (Character based) to do the same? If the operator clicks on the X the program stops immediately what I do not want. And when I remove the Sys-Menu with the WINAPI WS-SYSMENU the operator has not the possibility to change the window, minimize it, etc.,
I am looking for a simple possibility just to activate a flag if he uses X and with
IF WINDOWCLOSED GO TO CLOSING-PROCEDURE. Continue my program.
Thanks for any help
Rolf
#WINDOWCLOSEDYour recommendation looks very good. I even found a demo "Quitter" that Works almost good.
My problem is now: If the program executes a normal STOP RUN it enters the "cblExitProc" and the Keybord is enabled.
But if I close the Window with X it also enters the "cblExitProc" and displays the conditions. But the keybord is NOT enabled. After 5 seconds the window is cleared and the program ends. The operator has no chance to input anything. What must I consider in order to enable the keybord?
If I call an other program happens the same: the program starts but with no possibility to type anything.
With Dialog System I have the possibility to continue the program if the operator used the event WINDOW-CLOSED in order to execute some closing procedures before the program stops.
What can I do when I use a Text Window (Character based) to do the same? If the operator clicks on the X the program stops immediately what I do not want. And when I remove the Sys-Menu with the WINAPI WS-SYSMENU the operator has not the possibility to change the window, minimize it, etc.,
I am looking for a simple possibility just to activate a flag if he uses X and with
IF WINDOWCLOSED GO TO CLOSING-PROCEDURE. Continue my program.
Thanks for any help
Rolf
#WINDOWCLOSEDthanks this is a solution.