Solved

Window style in Windows programming

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

728 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