How to scroll past my Win32 app window size

Jun 1, 2014 at 8:57pm
Hi,

I have a basic Win32 app in which the main window has a vertical scroll bar:

1
2
3
4
5
6
7
	hWnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		(LPWSTR)g_szClassName,
		_T("Win32 App Demo"),
		WS_OVERLAPPEDWINDOW | WS_VSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT, 500, 1000,
		NULL, NULL, hInstance, NULL);

The vertical scrollbar works fine.

My problem is that I am going to display a large number of lines of text on the window, way more than will show on a app with a reasonable height. I need to have the window stay the same size but be able to scroll down past its end and display text below as text above scrolls off the top. I need my app window to act like the content window on this forum when you are posting a message to the forum.

Is there a way to do this and if yes how?
Jun 2, 2014 at 6:57pm
if you are printing text in some kind of window, like EDIT or RICHEDIT, add scrollbars to it?
Jun 2, 2014 at 8:41pm

Thank you again for replying. I am a good Java programmer but am feeling my way into C++.

I had tried to put scrollbars on a rich edit before I tried them on the main app window because I was pretty sure it wouldn't do what I wanted (and I was right) but I couldn't get the scrollbars to show on the rich edit.

I did some more digging, figured out what I was missing, and now my rich edit has scroll bars! So I'm perfectly happy with a rich edit but I need to be able to catch when the user types the '\n" at the end of a line so I can get his one-line input and process it.

I have tried

1
2
3
	LRESULT eventMask = SendMessage(g_hRichEdit, EM_GETEVENTMASK, 0, 0);
	eventMask |= ENM_SCROLL | ENM_CHANGE | ENM_SELCHANGE | ENM_KEYEVENTS | EM_EXSETSEL;
	SendMessage(g_hRichEdit, EM_SETEVENTMASK, 0, eventMask);


and catching EN_MSGFILTER in my WndProc and RichEditProc; the message doesn't get caught.

I know this isn't the subject of this post but do you know how to do this?
Topic archived. No new replies allowed.