[−][src]Function winconsole::console::set_ctrl_handler
pub fn set_ctrl_handler(
handler: Option<unsafe extern "system" fn(_: u32) -> i32>,
add: bool
) -> WinResult<()>
Adds or removes a handler routine from the console.
Arguments
routine- The callback function. If this is None, a value oftrueforaddwill ignore CTRL + C input, and a value offalsewill restore normal processing.add- Should the routine be added or removed?
Examples
unsafe extern "system" fn handler(event_type: u32) -> i32 { if event_type == 0 { println!("CTRL + C pressed."); return 1; // TRUE } return 0; // FALSE } console::set_ctrl_handler(Some(handler), true).unwrap();
Errors
IoError: Returned if an OS error occurs.