Euphoria Ticket #751: allow_break()/check_break() on win xp

allow_break() and check_break() don't work on Windows XP SP3 (ie. allow_break(0) do not prevent a program from being terminated with ctrl-break key press).

There is some code I wrote to implement functionality declared in the manual:

include std/console.e 
include std/dll.e 
constant kernel32 = open_dll("kernel32.dll") 
constant SetConsoleCtrlHandler = 
    define_c_func(kernel32,"SetConsoleCtrlHandler", {C_LONG,C_LONG},C_LONG) 
integer breaks 
function CtrlHandler(atom ct) 
    breaks += 1 
    return 1 
end function 
procedure allow_break(integer i) 
    breaks = 0 
    c_func(SetConsoleCtrlHandler,{call_back(routine_id("CtrlHandler")), not i}) 
end procedure 
function check_break() 
    integer b = breaks 
    breaks = 0 
    return b 
end function 
puts(1,"Press Ctrl+Break or try to close the console window\n") 
integer k 
while 1 do 
    if check_break() then 
    end if 
end while 


Type: Bug Report Severity: Normal Category: Library Routine
Assigned To: unknown Status: New Reported Release: 4.0.3
Fixed in SVN #: View VCS: none Milestone:


Quick Links

User menu

Not signed in.

Misc Menu