Solved

Window style in Windows programming

Posted on 1998-09-28
5
360 Views
Last Modified: 2013-11-20
In MFC, we can easily constuct window at anytime(by calling windows API). However, can I creat my own window in a different style? Can anyone give me a hint or some reference web site?
0
Comment
Question by:Hardaway
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Author Comment

by:Hardaway
ID: 1322668
What I mean is about the whole window style, just like having different fonts in the window title and having different color in the background !!
0
 
LVL 2

Expert Comment

by:MelissaC
ID: 1322669
Maybe derive your own class from CWnd and change all you want. Then you've got your own Window-class.
0
 

Expert Comment

by:lbrucher
ID: 1322670
By Window style, people usually refer to style you give a window on its creation. See CreateWindow() and CreateWindowEx() APIs for a description of the styles: whether the window is a popup, overlapped, etc.; whether it has min/max buttons on the title bar, etc etc etc.
I haven't seen many apps changing the font on the title bar. If you want to do this, your app will probably have to respond to WM_NC_xxx messages.
About changing the background color, this is usually done when you create the WNDCLASS for your new window.
If you need more info, do not hesitate...

0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 50 total points
ID: 1322671
4 WAYS OF SETTING THE STYLE

1. MFC usually has a Create member in each class deriving from CWnd (which includes all controls, dialogs and views).  This usually (always ? - didn't check them all) has a style parameter, for each CEdit::Create is defined

CEdit::Create
BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

2. If you create a Window using CreateWindow/CreateWindowEx (API calls) these include the style.  You can use the Attach member of CWnd (or other classes) to attach the C++ object to an an already exist window

3. You can change the style of an already existing window using ModifyStyle (not all window types know about this and respond appropriately - basically suck it and see)

ModifyStyle( styles_to_remove, styles_to_add ) ;

List the Styles in each part, separated by |

4. When an MFC C++ window object is being created, PreCreateWindow member is called.  You can derive a class and override this member to modify the style during the creation of a window

cs.style |= WS_somestyle ; /* add a style */
cs.style &= ~WS_someotherstyle ; /* remove a style */

Typically you use this approach if you want to modify the style of a MFC window class such as the applications MainFrame

0
 
LVL 1

Author Comment

by:Hardaway
ID: 1322672
Thanks for your suggestion. However, can you find screen shot that shows the MFC worked out a different style window ?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 178
Hibernate methods 2 87
abstract class with all non abstract mentods 6 87
unix example issues 18 113
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Suggested Courses

734 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