Solved

Window style in Windows programming

Posted on 1998-09-28
5
349 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
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 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

15 Experts available now in Live!

Get 1:1 Help Now