Handmade Hero»Forums»Code
22 posts
Disable selection highlight in an edit control when it gains and loses the focus

The Windows API docs state that, by default, an edit control shows and hides the selection highlight when it gains and loses the focus.

Meaning that when text is highlighted in an edit control, no matter how many times the focus of that control was lost and gained back, the edit control always remembers the state of the text and keep it highlighted whenever it's in focus.

Does anyone have a clever subclassing trick to make it do the opposite and never highlight text that was previously highlighted when the edit control was in focus?

Gaurav Gautam
98 posts
Disable selection highlight in an edit control when it gains and loses the focus

I haven't used it. But can't you just use the Edit_SetSel to remove all the selection on losing focus? I just read the docs, so I may be saying nonsense here.