Solved

Window in VC

Posted on 1998-10-09
1
201 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

830 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