AridTag

Hi, is it possible to silently scroll the Rich Edit as new data is added to it I use the box to display log information but there are other controls in the window that require you to type in them. The way that I have the box scrolling right now interupts you typing and sets the focus on the box everytime something is added.

Code Block

void ScrollDown(HWND hScrl)

{

//Scroll to the bottom of the window

int boxlen = GetWindowTextLength(hScrl) + 1;

SetFocus(hScrl);

SendMessage(hScrl, EM_SETSEL, (WPARAM)boxlen, (LPARAM)boxlen);

SendMessage(hScrl, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);

}



Re: Windows SDK Question about scrolling a Rich Edit box in Win32

Pintu Shukla

Question is not clear to me can you elaborate i little bit More, you asked the question " Question about scrolling a Rich Edit box in Win32 " and inside your Post you asked that you have a list box and you want to scroll the item of list box etc.


Edit :- Don't Make changes in your old Post Correct it in new terms of new Post See now my old Reply create no sense here any way i am going to delete it here is alink just go with this. And remember a Simple Concept your Scrolling depend on the Selection of Area in any control if it is not at the visible area of the window .Then window will automatically perform scrolling so that the selection can be visible to you.

Current Selection in a Rich Edit Control


Thanx





Re: Windows SDK Question about scrolling a Rich Edit box in Win32

AridTag

that was a typo...rather tired when typing that. Its Rich Edit not listbox.





Re: Windows SDK Question about scrolling a Rich Edit box in Win32

AridTag

Why was this topic moved to....

Windows SDK
Discuss Windows Vista SDK Documentation, Samples and Tools.

when this partains to c++

But anyway Is there no one that knows a way to silently scroll the box





Re: Windows SDK Question about scrolling a Rich Edit box in Win32

Sheng Jiang (?κΙ)

Code Block
HWND h=(HWND)hwndRichEdit;
int line = SendMessage(h, EM_GETFIRSTVISIBLELINE, 0, 0);
int linecount = SendMessage(h, EM_GETLINECOUNT, 0, 0);
SendMessage(h, EM_LINESCROLL, 0, (linecount - line - 2));







Re: Windows SDK Question about scrolling a Rich Edit box in Win32

AridTag

Thank you very much Sheng...worked like a charm.