Search code examples
winapieditcontrol

Get the line number in Edit control


how can you get the current line number in a multi-line edit control?


Solution

  • From the docs for EM_LINEFROMCHAR, if you pass -1 as wParam, you get the line number of the line containing the caret (or the start of the selection if there is one).