High Everbody,
How can I trap the Windows Shutdown with NE5.1?
High Everbody,
How can I trap the Windows Shutdown with NE5.1?
High Everbody,
How can I trap the Windows Shutdown with NE5.1?
You can use the CBL_EXIT_PROC library routine to trap a program shutdown and execute your own exit handler code:
Example:
id division.
program-id. testexit.
data division.
working-storage section.
01 install-flag pic x comp-x value 0.
01 install-params.
05 install-addrs procedure-pointer.
05 install-priority pic x comp-x.
01 status-code pic x(4) comp-5 value 0.
01 any-key pic x.
procedure division.
set install-addrs to entry "myclose"
call "CBL_EXIT_PROC"
using install-flag
install-params
returning status-code
end-call
display "this is test"
accept any-key
display "after accept"
stop run.
entry "myclose".
display "in close procedure".
accept any-key.
High Everbody,
How can I trap the Windows Shutdown with NE5.1?
That it, thank you - Georg Jarzak
High Everbody,
How can I trap the Windows Shutdown with NE5.1?
Hi Chris,
CBL_EXIT_PROC is a nice call, but when I shutdown Windows without ending the program the procedure "myclose" is not executed.
High Everbody,
How can I trap the Windows Shutdown with NE5.1?
To reliably catch Windows OS shutdown processing, you have to write a Windows system service and let it catch the SERVICE_CONTROL_PRESHUTDOWN (not available in XP or Server 2003) or SERVICE_CONTROL_SHUTDOWN notification message from the service controller. This is not extremely complex, but not trivial either. See the Microsoft documentation for more information:
msdn.microsoft.com/.../ms685141(v=vs.85).aspx
msdn.microsoft.com/.../ms683241(v=vs.85).aspx
This is part of the design of the Windows operating system, not a Micro Focus limitation.
A program with a window should get a WM_CLOSE notification when it is closed for any reason, including Windows system shutdown, but that's not as reliable as using the service controller.
It's possible to write a service that does nothing but wait for the PRESHUTDOWN message, and notifies applications through another mechanism such as a Windows event object. This is also not trivial.
High Everbody,
How can I trap the Windows Shutdown with NE5.1?
This procedure Works very good after a normal stop run in the program that is after the following:
1.- start the program
2.- the program displays "this is test
3.- I hit return
4.- the program displays "after accept"
5.- the program displays "in close procedure"
6.- I can enter something
7.- I can modify the program with somethink like "IF any-key" = ........... ETC.
But if I do not use the normal stop run procedure, but instead close the window with X almost the same happens, but it is not posible to enter any key and not make the program decide what to do:
1.- start the program
2.- the program displays "this is test
3.- I close the window with X
4.- the program displays "in close procedure"
6.- It is not posible to enter anything
7.- the display stays for 5 seconds and everything finishes
8.- I can NOT modify the program with somethink like "IF any-key" = ........... ETC.
Whay must I change in order to give the operator the possibility to select between different choices?
Thanks for any help
Rolf
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.