Solved

Window style in Windows programming

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WinWaitActive parameters 12 31
notReplace  challenge 53 142
while loop over for loop 7 115
Is there a simple front-end menu system. 9 105
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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