From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e812d69362dc764c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-17 14:42:52 PST Path: supernews.google.com!sn-xit-02!supernews.com!wn4feed!worldnet.att.net!207.35.177.132!news3.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail From: "Freelancer" Newsgroups: comp.lang.ada References: <3A3B78F4.433594D8@acm.org> Subject: Re: How to lock keys. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Sun, 17 Dec 2000 22:40:55 GMT NNTP-Posting-Host: 64.229.193.227 X-Trace: news20.bellglobal.com 977092855 64.229.193.227 (Sun, 17 Dec 2000 17:40:55 EST) NNTP-Posting-Date: Sun, 17 Dec 2000 17:40:55 EST Organization: Sympatico Xref: supernews.google.com comp.lang.ada:3219 Date: 2000-12-17T22:40:55+00:00 List-Id: Thanks for answering my question. Here's what I tried to do which I know is all wrong, but I have no clue about windows programming so please give me a break : with text_io; with win32; with win32.wincon; use text_io; procedure test is bool1 : win32.BOOL := 1; bool2 : win32.BOOL; hdle : win32.wincon.PHANDLER_ROUTINE; ctrlc : win32.DWORD := 0; -- supposing 0 is for the CTRL-C event begin bool2 := hdle (ctrlc); -- If I don't put this, it runs, if I do, it gives me a constraint_error, due to a access error bool2 := win32.wincon.setconsolectrlhandler (hdle, bool1); get(c); -- Before entering a character, I pressed CTRL-C and it doesn't work (happy for that) -- After entering the character, the program jams, and it doesn't close, and I can't recompile it after. end test; This crashes the program of course. Could I get some help on working this function please? "Marin David Condic" wrote in message news:3A3B78F4.433594D8@acm.org... > Great minds think alike! :-) Just saw this after posting my earlier response > concerning SetConsoleCtrlHandler. > > Additional information: Look for a package in the Win32ada binding (don't know > where it is in Object Ada, but I believe it exists somewhere there!) named: > > package Win32.Wincon is > > The call you want to investigate is: > > function SetConsoleCtrlHandler( > HandlerRoutine: PHANDLER_ROUTINE; > Add : Win32.BOOL) > return Win32.BOOL; > > How to hook up to this and provide a handler routine would seem to be a fair Ada > related question. > > MDC > > DuckE wrote: > > > Under Windows NT (the doc's indicate this should work under 98) there is a > > function called "SetConsoleCtrlHandler" that permits you to add a handler > > callback that is invoked when Ctrl+C is typed. The action that is taken > > depends on the return from this function. > > -- > ====================================================================== > Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/ > Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m > Visit my web site at: http://www.mcondic.com/ > > "Giving money and power to Government is like giving whiskey > and car keys to teenage boys." > > -- P. J. O'Rourke > ====================================================================== > >