Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-07

CTRL + Break

7 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dirk Verwiebe

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

Reply by email

Lee, John

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.

Reply by email

Lee, John

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

Show quoted text 58 lines
-----Original Message----- From: Sent: 20 July 2001 13:23 To: Subject: RE: [fpc-pascal]CTRL + Break 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; > >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 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.

Reply by email

Unknown author

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;
Show quoted text 19 lines
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

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.

Reply by email

Lee, John

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

Show quoted text 21 lines
-----Original Message----- From: Sent: 20 July 2001 14:47 To: Subject: RE: [fpc-pascal]CTRL + Break 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

Reply by email

Unknown author

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

Reply by email