Click here to Skip to main content
15,889,874 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello everyone!

I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.

I need to customize main window's frame to have following characteristics:

- It displays an icon ( just as same as normal window does );

- It displays title ( just like normal window ) but text is in orange color;

- It displays minimize, and close buttons ( there is no maximize button );

- Buttons for minimize and for close have icons different than ones that normal window has.

I work in MS Visual Studio Express 2008, on Windows XP, in C++, using pure WIN32 API.

If any other information is required ( source code or something similar ), please ask for it, I will more than gladly supply it.
Posted
Comments
JasonMacD 17-May-13 12:25pm    
Ok, there's your requirements now what have you tried or are you expecting everyone else to write the program for you and give you the code. If that's the case, how much would you charge, I'll do it if the price is right.

1 solution

This is not a part of owner draw. This is non-client area which should be handled by non-client drawing, via handling non-client messages and message parameters: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162743%28v=vs.85%29.aspx[^].

Another approach could be a work-around which is sometimes used, but in more exotic window designs. You can create window in a style using no non-client areas at all: no borders, no title bar. In this case, you can simulate non-client elements in your client area, which is in this case the whole window area.

[EDIT]

Answering follow-up questions, from the comment to this answer:

  1. Non-client drawing would be made of two parts: rendered by OS and something you draw in your application the way explained in the article referenced above. I don't think you can mode anything drawn by OS, you can only draw on top of it. Of course, you can also disable some elements.
  2. As I said, you can achieve a window without non-client areas by its styles. It can be like
    SetWindowLong(hWnd, GWL_STYLE, some_styles);
    Please see:
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%29.aspx[^],
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx[^],
    http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543%28v=vs.85%29.aspx[^].

    I believe that none of the style bits will already make such window:
    SetWindowLong(hWnd, GWL_STYLE, 0);


—SA
 
Share this answer
 
v3
Comments
MyOldAccount 17-May-13 12:50pm    
My original idea was to create a window that has icon, text, and buttons created the way I want, and then to just " paste " it over the main window's frame.

However, your solution may be just what I need!

My questions to you are following :

-----------------------------------------

1.)

Can I create a window with desired characteristics ( icon, title, buttons ) and set it at position with coordinates ( 0, 0 ) in the client area ?

2.)

How to create borderless, titleless window ?
I have tried several things, but the frame stayed on...

---------------------------------------

I hope that my questions are not too confusing.
Anyway, thank you for this creative advice, I will try to implement it myself and will report my success.
Sergey Alexandrovich Kryukov 17-May-13 13:53pm    
No, the questions are not confusing, they are clear enough, thank you for that.
I answered, please see the updated answer above, after [EDIT].
—SA
MyOldAccount 17-May-13 14:46pm    
The blue frame stays, icon + caption + system menu are gone.
I will keep trying to find out how to remove the frame...
Sergey Alexandrovich Kryukov 17-May-13 14:50pm    
Strange. Take the regular styles (by GetWindowLong, same parameters) and remove WS_CAPTION. Is it gone?
Remove some other bits according:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx

Did you finally achieve it? Please try and report back...

Probably you need just
SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);

If you do, look at remaining styles bits (say, under the debugger) and use only them next time.

—SA
MyOldAccount 17-May-13 15:18pm    
I can't use WS_POPUP, my main window has child windows...
EDIT:
----------------
I have tried it anyway, and it works.
However, I can't move window,it stands where it was created.
How can I make him moveable?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900