Solved

Window in VC

Posted on 1998-10-09
1
194 Views
Last Modified: 2010-04-15
How can I do a window with vertical scrollbar and text in it with CreateWindow function.
0
Comment
Question by:arip
1 Comment
 
LVL 8

Accepted Solution

by:
Answers2000 earned 100 total points
ID: 1253451
An edit control (which can also be set to not allow editing) fits this criteria

HWND hWndEdit ;
hWndEdit = CreateWindow(
"edit",
"Hello world",
WS_CHILD | WS_VSCROLL | ES_LEFT | ES_MULTILINE, /* Add ES_READONLY if you don't want user to be able edit */
x,
y,
nWidth,
nHeight,
hWndParent,
(HMENU)1000,
hInstance,
NULL
) ;
 
1. Edit control can not be a top level window.  Therefore create this as a child window of your frame window (e.g. Call this when WM_CREATE is sent to your frame).  Your frame should include WS_CLIPCHILDREN style.

2. Don't forget to make this visible
ShowWindow( hWndEdit, SW_SHOW ) ;

3. Size this control x,y,nWidth,nHeight to fit your frame client area.  If you want to make it fit changes in the frame size, resize hWndEdit in response to WM_SIZE being sent to your frame.

4. Retain hWndEdit in a global or static variable.



0

Featured Post

Are end users causing IT problems again?

You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now