CRT Documentation: Reference |
[This type does not have a corresponding DOS type.]
Used when overriding the default Crt console event handler.
TCrtEventProc = function(CtrlEvent: longword): boolean;
True if the event was handled, otherwise False.
This type defines the expected function definition for CrtEventProc. When implementing a custom handler for CrtEventProc, this definition can be used as a guide to get the variable list and return value setup correctly.
When your handler is called, it is called from the context of a newly created thread in your process. Take care to handle synchronization and other multi-threaded issues.
Although not required, it would probably be good practice to save the existing CrtEventProc and call it if you don't handle the event (this could conceivably lead to a chain of events being followed to try and find a handler to process it). Future versions of this unit may include this functionality built-in.
The value passed in CtrlEvent will be the exact value passed by Windows when the internal handler is called (this is to allow for future events without the need to recompile this unit). Consult the Microsoft Platform SDK for details, updates, and changes.
Crt Overview, CrtEventProc