CreateSimpleReBar in WTL vista/7 native look and feel - c++

When using the CreateSimpleReBar in WTL the main menu bar has this blue color on mouse hover and not the native vista/7 round and transparent shape. Also for some reason the menu bar seems taller then the usual native one.
Does CreateSimpleReBar draw the menu itself or am I missing something?
http://imageshack.us/photo/my-images/259/wtlmainmenu.png/
HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
// attach menu
m_CmdBar.AttachMenu(GetMenu());
// load command bar images
m_CmdBar.LoadImages(IDR_MAINFRAME);
// remove old menu
SetMenu(NULL);
// Set m_hWndToolBar member
CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
// Add a band to the rebar represented by m_hWndToolBar
AddSimpleReBarBand(hWndCmdBar);

CreateSimpleReBar creates a rebar control, and the menu is one of the rebar bands, created by m_CmdBar.Create - WTL's CCommandBarCtrl class. The latter custom-draws the menu to mimic OS behavior, including blue highlighting with COLOR_MENUHILIGHT (atlctrlw.h).

Related

Frameless window with min/max/close buttons (Windows)

On Mac there is a window flag/call: WindowTitleHidden + [nativeWindow setTitlebarAppearsTransparent:YES]
which basically makes the title bar to be "embedded" inside the window itself instead of creating a frame that "holds" the window. Like this:
Notice how the minimize, maximize and close buttons are on the same row as the app's widgets.
Is there something similar for Windows?
Like this:
Code: https://github.com/alexandernst/TrueFramelessWindow
AFAIK, you must draw them yourself and then reply to the WM_NCHITTEST mesage that Windows sends to your form to query where the mouse is positioned. That way you can tell Windows that the mouse is located over a, say, maximize button, although Windows itself didn't draw one there.
The painting can be done with the help of VisualStyleRenderer or ControlPaint.
I hope these questions will point you further:
Winforms: Add a close "x" button in a UserControl
Winforms - WM_NCHITEST message for click on control

windows beneath not being painted when using a layered window

I will try to explain my problem the best i can,
I'm creating a layered window in c++ (using windowsXP), all works fine until i drag my created window near the windows start button, and then when i press the star button of windows taskbar and close it again all the windows beneath of my layered window aren't being painted (only in the area of the start window that pops over my window).
My create window is like this:
CWnd::CreateEx( WS_EX_TOOLWINDOW |
WS_EX_LAYERED,
AfxRegisterWndClass(0),
lpstr_name, WS_POPUP, 0,0,0,0,
pc_parent->GetSafeHwnd(), 0);
...
When i create the window with this styles the problem ocurrs, but if i create with the extended style WS_EX_TRANSPARENT and all the others the problem does not occur any more. And if instead of a WS_POPUP window is a WS_CHILD or WS_OVERLAPPED then this also doesn't occur...
Can anyone please explain why when i create a WS_POPUP window with the WS_EX_LAYERED style all the beneath windows aren't updated, and if i add the style WS_EX_TRANSPARENT this works fine.
Note: why i do not use the WS_EX_TRANSPARENT style if it works right? if i use it then my window can not be dragged and i need it to do it :)
Updated:
alt text http://img17.imageshack.us/img17/586/clipboard01il.jpg
The image above is to describe better what is happening:
The first part of the image you can see my leyered window and beneath is the vs, in the second img i press the start button and then in the last image i already drag my layered window to the right and you can see that the vs window does not updates the affected area.
Note that this situation until now only occurs with the start window?! with other windows it does not happen!?...
Thanks
only in the area of the start window that pops over my window
That's expected. Only that clipping rectangle is obscured by the start menu so only that region will be repainted. What behavior are you expecting? If there are windows covered by more upper level windows, then they won't be repainted either -- why repaint something just to paint over it?
All underneath windows need to get repainted though if you use transparent because GDI can't calculate the final color of the pixel without knowing the area below the window's color.

Bona fide transiant windows with WinAPI?

I want to create a Window like when a context menu pops up or clicking the menubar. I want a Window that will be like this and that I can take over its paint event. Sort of like what is created when you select a sub tool in Photoshop.
EDIT:I want to know how to create controls like the one that comes when you select a sub tool in Photoshop, these do not seem to have a parent window. Those little description popups are a good example of this type of window, and menu items, those rectangles have no parent window.
Thanks
EDIT2: see this: http://cdn-viper.demandvideo.com/media/CB3C805F-421E-45AE-8359-39D59D8F0165/jpeg/20412728-192C-462A-AF8E-1F30BA77AE05_2.jpg
You will notice the window for the sub tools, it is not constrained to a parent window.
But how do they get a nice shadow
around it, and how does it still stay
with the main window without a parent?
That's your real question.
There are several ways of getting the shadow. One is that the window is actually two windows, the "shadow" plus the "main" window.
When you create the flyout window (that's what it's called), you position it near the toolbar. If the toolbar gets a WM_MOVE message, it's your responsibility to call MoveWindow() on the flyout to keep it lined up.
Edited to add
The dwExStyle parameter of CreateWindowEx() should include WS_EX_LAYERED and probably WS_EX_TRANSPARENT, because the 'shadow' will use alpha blending. The hWndParent parameter is the application's main window. The x and y parameters must be calculated as an offset of whatever button the window is to be associated with.

How do you have a window that has no icon in the tasktray?

I found the windows style WS_EX_TOOLWINDOW but this changes the title bar. Is there a way to not have the tasktray icon but keep the normal window titlebar?
You usually do want to do this if you have added an alternate means to restore the window - for example placing an icon in the notification tray.
The usual way of ensuring the taskbar does not display your window is to create it with a hidden parent window. Whenever a window has a parent, the parent window is used to create the button - hidden windows are not shown on the taskbar.
Also, WS_EX_APPWINDOW should be removed as that performs the opposite hint to the shell and forces the window onto the taskbar even if it would otherwise not have been shown.

How to draw something to the screen and have the underlying ui interactive

I seeking solution for Windows first.
I need to add visual effects to screen image without breaking the interactivity of all and every controls, that are on this screen.
The solution can be straightforward:
1. take a screenshot
2. show this screenshot in a separate window, above other windows
3. apply the effect to image, being shown on this window
But, this window (containing screenshot) makes any buttons and other controls below, unreachable for mouse interaction (clicking, hovering)
Is there any way to do this ?
From MSDN's documentation on layered windows...
"Hit testing of a layered window is based on the shape and transparency of the window. This means that the areas of the window that are color-keyed or whose alpha value is zero will let the mouse messages through. However, if the layered window has the WS_EX_TRANSPARENT extended window style, the shape of the layered window will be ignored and the mouse events will be passed to other windows underneath the layered window."
Here's an article about it. Notice this additional warning:
"setting the WS_EX_TRANSPARENT attribute affects the entire window: the user can't close the window using the 'x' button, select it with the mouse, or select any controls on the window. The application can still close the window programmatically."
Depending on what you're actually drawing and where, it might be more appropriate to use Owner-Drawn Controls rather than hover an "onion skin" over your whole window.