Search code examples
c++ctextboxscrollbarrichedit

how do i scroll to the bottom of the textbox useing EM_SETSCROLLPOS in SendMessage?


I tried this:

tagPOINT mypoint;
    mypoint.x=0;
    mypoint.y = (17 * (tmsgcount - 16)) + 5;
SendMessage(hwnd,EM_SETSCROLLPOS,0,(LPARAM)&mypoint);

i was trying to calculate the height i should scroll down to get to the bottom of the scroll bar with the point. But this only work when i have the same font type size and screen resolution and does not seem like the proper solution.

if i new how i could get the height of the text in the text box i could use that, or if there is some already defined value for a scroll to bottom value? I can find so little examples online. any help please?


Solution

  • You can send EM_LINESCROLL to scroll to the last line.