Ctrl+Break how to catch it ? 
Author Message
 Ctrl+Break how to catch it ?

I've got simple program. It changes textmode and cowers the screen with
colorful signs. If i press enter it changes textmode to the privious state
then ends. My teacher told me that proffesional program should change
textmode even when i press ctr+break. Now if i do c+b it ends but It does
not chane textmode so the resolution is incorrect. My Q is how to write
procedure wich nows when I press ctr+break and if i do it it makes something
(ie. textmode(..) ) and then quits. Sample procedure easy to use will be a
real gift for me TX!!!!

sorry for my bad language :-)



Sat, 12 Apr 2003 07:05:00 GMT  
 Ctrl+Break how to catch it ?


Quote:
> I've got simple program. It changes textmode and cowers the screen
with
> colorful signs. If i press enter it changes textmode to the privious
state
> then ends. My teacher told me that proffesional program should change
> textmode even when i press ctr+break. Now if i do c+b it ends but It
does
> not chane textmode so the resolution is incorrect. My Q is how to
write
> procedure wich nows when I press ctr+break and if i do it it makes
something
> (ie. textmode(..) ) and then quits. Sample procedure easy to use will
be a
> real gift for me TX!!!!

> sorry for my bad language :-)

There are two approaches to do this:
1. Use ExitProc (see help). Whenever the program quits, it calls this
procedure which resets the screen mode.
2. Use the keyboard controller directly. Doing this you can even catch
Ctrl-Alt-Del, but it is very difficult.

BTW, professional programs do not react when you press C-B (or at least
they pop up a window asking you if you want to quit). But the first
approach is unfortunately not enough for doing this...

And, also try SetCBreak from the unit Dos.

Beware: 1. or SetCBreak do not work when your program is called from
the IDE!

--
Rudolf Polzer
REBOUNCE - http://www.mycgiserver.com/~rebounce

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Ctrl+Break how to catch it ?
uses graph;

{...}

var oldexitproc: procedure;
procedure myexitproc;
begin
    exitproc := oldexitproc;
    closegraph;
end;

{...}

begin
    oldexitproc := exitproc;

    {...}
end.
{ you do not need CloseGraph in your main program block any more! }

--
Rudolf Polzer
REBOUNCE - http://www.mycgiserver.com/~rebounce
I wish I was what I was when I wished I was what I am now.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to catch Ctrl+C or Ctrl+V

2. How to catch Ctrl+C or Ctrl+V

3. How can i disable the ctrl - break

4. ctrl-break interrupt?

5. No consequence on Ctrl-BREAK

6. Disable ctrl+break in Free Pascal [little OT]

7. Disable ctrl+break in Free Pascal [little OT]

8. freepascal - Ctrl Break displayed as ^C even when trapped

9. TVision an Ctrl-Break Handling

10. Ctrl+Break error while running prog from BP7 DOS window

11. RESET OVERRIDE (CTRL-ALT-BREAK) ??

12. RESET OVERRIDE (CTRL-ALT-BREAK) ??

 

 
Powered by phpBB® Forum Software