SetConsoleCtrlHandler

I wonder if anyone can please help me.

I am calling DOS programs from within my Delphi program, and I would like
to be able to
detect when a DOS program has ended. I would prefer to test this with some
kind of event
being triggered when the DOS progranm ends. I read about this
SETCONSOLECTRLHANDLER function, tried it, but I couldn't get it to work.
Has anyone else
tried this procedure and got it working?  If you have please tell me about
it.

Thanks

Firoz