How can i catch a CTRL + Break (DOS Go32)?
I want give resources free after stopping my program with these keys. It should work in graphic mode,too.
regards
Dirk Verwiebe

Mailing lists / fpc-pascal / 2001-07
7 messages · 3 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
How can i catch a CTRL + Break (DOS Go32)?
I want give resources free after stopping my program with these keys. It should work in graphic mode,too.
regards
Dirk Verwiebe
Something like this test program could do it...Put your stuff in the sigint: branch...
program tst;
uses ctrl_c;
var NewSignal,OldSigSegm,OldSigInt : SignalHandler;
Function CatchSignal(Sig : longint):longint;
begin
case Sig of
SIGSEGV : begin
{ Temporary message - until we get an error number... }
writeln ('Panic : Internal compiler error, exiting.');
Halt(99);
end;
SIGINT : begin
WriteLn('Ctrl-C Signaled!');
Halt(1);
end;
end;
CatchSignal:=0;
end;
begin
{must be doing i/o otherwise ctrl/c does not work}
repeat write('.'); until false;
end.oops ... sorry - I had the lines in my file but deleted them before I sent it (& didn't check!) because thought they weren't needed! J
Antwort auf Mail von Lee, John vom 20.07.2001 10:59:31:
Hi John,
thank you for your hint.
Catching CTRL+Break now works.
I modified your program a little bit.
regards
Dirk Verwiebe
program tst; uses ctrl_c;
should be.
uses dpmiexcp;These lines are missing.
NewSignal:=SignalHandler(@CatchSignal);
OldSigInt:=Signal (SIGINT,NewSignal);{must be doing i/o otherwise ctrl/c does not work} repeat write('.'); until false; end.
There are quite a few (many?) dos compatibity issues on w2k because, of course, it's a dos simulator being used not good old dos itself ...many of the dgjpp things eg make & maybe others don't work at all/ properly... dunno about dpmi...so that might be your problem...Some of my fpc colleagues (I don't agree!) have even suggested that fpc shouldn't be supported on w2k (sigh)...J
My next question:
I tried it under win 2000 in a dos box. It seems win2k is faster and stoped my program with a messagebox in the gui.
Is it possible to make it work in win2k, too ??
Dirk Verwiebe