Traditionally, pressing Ctrl+ Backspace in a Win32 text control such as an Edit or ComboBox would generate a delete control character corresponding to ASCII code 127. In many Windows applications such as the Windows 10 version (and before) of Notepad, ctrl+ backspace will generate a “square” character. See below:
MFC and earlier versions of .Net wrapped Win32 WinForm Controls exhibited this “square” character behavior when ctrl+ backspace was pressed. However, in newer versions of .Net the out of the box behavior was changed so for each ctrl+ backspace the most recent whole word in the control would be deleted. This conforms with many other text controls such as those found on webpages. With regard to .Net controls, the earliest versions, the controls worked just like their MFC counterparts with regard to this behavior. Then with the arrival of “autocomplete”, the behavior was avaiable but not by default (see this link Winforms Textbox – Using Ctrl-Backspace to Delete Whole Word). With VS 2019, the behavior is available from the get-go.
Does anyone have a simple MFC solution to change the “out of the box” behavior of controls such as and CComboBox to delete the most recent whole word instead of outputting the character 127 “square”? I’ve seen some projects online that implement an entire autocomplete interface but that is overkill for the one change I require. Worse case, I figure I could subclass the controls and in the wnd message loop, delete the last word whenever a character 127 is encountered.
I would like to hear your suggestions 🙂