comp.lang.ada
 help / color / mirror / Atom feed
From: "DuckE" <nospam_steved94@home.com>
Subject: Re: How to lock keys.
Date: Mon, 18 Dec 2000 01:30:54 GMT
Date: 2000-12-18T01:30:54+00:00	[thread overview]
Message-ID: <iNd%5.160819$U46.5198384@news1.sttls1.wa.home.com> (raw)
In-Reply-To: Xhb%5.16422$0U2.602221@news20.bellglobal.com

Here is the test code I used to see the SetConsoleCtrlHandler function at
work:

--------------------------- File TestHandler.adb --------------------
WITH CtrlCHandler;
WITH Win32;
WITH Win32.WinCon;
WITH Ada.Text_Io;

PROCEDURE TestHandler IS
  result : Win32.BOOL;
BEGIN
  Ada.Text_Io.Put_Line( "Start" );
  result := Win32.WinCon.SetConsoleCtrlHandler( HandlerRoutine =>
CtrlCHandler.MyHandler'ACCESS,
                                                Add => Win32.TRUE );
  DELAY 5.0;
  Ada.Text_Io.Put_Line( "Finish" );
  DELAY 2.0;
END TestHandler;

------------------ File: CtrlCHandler.ads --------------------------

WITH Win32;
PACKAGE CtrlCHandler IS

  FUNCTION MyHandler( ctrlType : Win32.DWORD ) RETURN Win32.BOOL;
  PRAGMA Convention( stdcall, MyHandler );

END CtrlCHandler;

------------------- File: CtrlCHandler.adb -----------------------

WITH Win32;
WITH Win32.WinCon;
WITH Ada.Text_Io;

PACKAGE BODY CtrlCHandler IS

  FUNCTION MyHandler( ctrlType : Win32.DWORD ) RETURN Win32.BOOL IS
  BEGIN
    Ada.Text_Io.Put_Line( "Handled!" );
    RETURN Win32.TRUE;
  END MyHandler;

END CtrlCHandler;

-----------------------------------------------------------------------

I hope this helps,

SteveD






      reply	other threads:[~2000-12-18  1:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-15 18:24 How to lock keys Freelancer
2000-12-15 19:26 ` Larry Kilgallen
2000-12-15 20:40   ` Freelancer
2000-12-15 22:18     ` Ted Dennison
2000-12-15 22:32     ` Mike Silva
2000-12-15 23:54     ` Gautier
2000-12-16  3:45   ` DuckE
2000-12-16 14:07     ` Marin David Condic
2000-12-15 23:56 ` Alexander Antonenko
2000-12-16  3:36 ` DuckE
2000-12-16 14:15   ` Marin David Condic
2000-12-17 22:40     ` Freelancer
2000-12-18  1:30       ` DuckE [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox