Miert nem jon CTRL_C_EVENT

Windows konzol programokat nem tudok megallitani CTRL_C-vel. Ugy emlekszem regrol, hogy a CTRL-C Windowson ugyanugy megallitja a parancssoros programokat, mint Linuxon, de mar nem vagyok biztos benne, mert evente legfelejebb nehany orat windowsozom. Ez egyebkent egy Win2K.

Irtam probakeppen, egy hello world szintu esemenykezelot, ami megkapja pl. az ablak (konzol) becsukas esemenyt, de nem kap CTRL_C_EVENT-et, hiaba nyomom neki a CTRL_C-t.

Hozzászólások

Megoldas a SetConsoleCtrlHandler dokumentaciojaban:

If the HandlerRoutine parameter is NULL,
a TRUE value causes the calling process to ignore CTRL+C input,
and a FALSE value restores normal processing of CTRL+C input.
This attribute of ignoring or processing CTRL+C is inherited
by child processes.

Panasz csak annyi, hogy az MS dokumentacio maga is azt mondja, hogy a _normal_ allapot a CTRL+C feldolgozas. Ehhez kepest csendben megvaltozott a default es kulon be kell allitani a normal-nak mondott allapotot.

--
CCC3