Solved

Window style in Windows programming

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generic progress indicator 6 117
Excel Use VBA to get user's Mac Address for their computer 5 174
tripleUp challenge 7 79
zeroMAx challenge 20 104
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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

809 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