OK. Then you can use a notify message EN_SELCHANGE, which inform you about cursor position changing. You can find out current line by means of EM_GETSEL, EM_LINEFROMCHAR, EM_LINEINDEX messages. Then, knowing total count of lines in the edit and current line you can calculate vert. scrollbar's thumb position. Something similar is possible for horz. scrollbar too Is it convenient solving for you?