The documentation of dwMode parameter of SetConsoleMode function specify:
ENABLE_QUICK_EDIT_MODE 0x0040
This flag enables the user to use the mouse to select and edit text.
To enable this mode, use ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS.
To disable this mode, use ENABLE_EXTENDED_FLAGS without this flag.
When this mode is enabled (the default) the mouse is used by cmd.exe to allows the user to select text from the command-line window screen. Besides, it seems that in certain windows versions (like Vista and/or 7) the mouse input in cmd.exe is not enabled by default.
If you want that your program get mouse events, you must enable mouse input and disable quick edit mode this way:
GetConsoleMode ( input_handle, &dwOldMode );
SetConsoleMode ( input_handle, ENABLE_MOUSE_INPUT | ENABLE_EXTENDED_FLAGS );
Perhaps you may want to preserve other mode flags from dwOldMode
and just modify the previous ones. Anyway, you must recover the original mode before the program ends this way:
SetConsoleMode ( input_handle, dwOldMode );