I want to either put a dialog box as a replacement for a SDI Windows frame, or put dialog type controls in the Windows Frame. I don't want a pop up dialog to show up. I would use a dialog based application if I could place a menu and toolbar on the top. They don't seem to be available.
I want to remove window from taskbar on Windows 10 with multiple desktops.
For Windows 8.1 i used ITaskbarList::DeleteTab and it works excellent.
For Windows 10 this method hides Windows from taskbar too, but after it i see this window on all desktops. I want to see this window only on one desktop.
Does anyone know the method to hide window from task bar in Windows 10 and stay this window on one desktop?
Below you can see, what i meant under "hide window from task bar in Windows 10":
In my understanding, borne out by my empirical tests, the windows that appear in the taskbar previews are exactly the same windows that would ordinarily appear in the taskbar. A long time ago, say in Windows 2000, each of an application's eligible windows would just appear as buttons on the taskbar. Starting in Windows XP, taskbar grouping became an option, so that all eligible windows from a single application could be grouped together and appear as a single button on the taskbar. Then, in Windows Vista, it became possible to display previews of these open windows when you hovered over the corresponding taskbar button. Neither Windows 8 nor Windows 10 changed that fundamental rule; they only changed the appearance of the previews.
As such, we can refer back to the MSDN documentation for the rules about which windows appear on the taskbar:
The Shell creates a button on the taskbar whenever an application creates a window that isn't owned. To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_APPWINDOW extended style. To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.
Raymond Chen has summarized these rules more precisely here. Quoting him:
There are some basic rules on which windows go into the taskbar. In short:
If the WS_EX_APPWINDOW extended style is set, then it will show (when visible).
If the window is a top-level unowned window, then it will show (when visible).
Otherwise it doesn't show.
(Though the ITaskbarList interface muddies this up a bit.)
You were muddying it up before, calling ITaskbarList::DeleteTab. That is not necessary. To ensure that a window does not appear in the taskbar, just apply the converse of the rules governing when a window does appear in the taskbar.
If you have a top-level unowned window, it will be shown in the taskbar unless you remove the WS_EX_APPWINDOW extended window style. If you have an owned window, then it will not be shown in the taskbar unless the WS_EX_APPWINDOW extended window style is set to force it there.
So if you have the WS_EX_APPWINDOW extended window style set, you should remove it. That is forcing the window to be displayed in the taskbar.
Otherwise, you should set an owner for your window. For example, make the second window be owned by the first.
TL;DR:
Remove both WS_EX_APPWINDOW and WS_EX_TOOLWINDOW from the extended style.
Set an owner for the window.
Example:
Removing flags from the extended style:
SetWindowLong(myHWND, GWL_EXSTYLE,
GetWindowLong(myHWND, GWL_EXSTYLE) & ~WS_EX_APPWINDOW & ~WS_EX_TOOLWINDOW);
Setting an owner:
SetWindowLongPtr(myHWND, GWLP_HWNDPARENT, myOwnerHWND);
Full explanation:
Despite Cody's answer being great, it does not quite answer the exact question.
The exact question is: "How to display a window that does not appear in the taskbar, yet appears only on one virtual desktop?
As Cody explained, there are several ways to remove the taskbar button for a window. However, there is only one way among them that makes it display on only one virtual desktop at the same time.
If you include the flag WS_EX_APPWINDOW in your extended style, it will force the window to show in the taskbar. That's why it must be cleared in this case.
If you include the flag WS_EX_TOOLWINDOW in your extended style, it will force the window not to show in the taskbar, but will force the window to be shown on all virtual desktops. Thus it's not an option either here.
Finally, if your window has neither flags, it will show in the taskbar if and only if it does not have an owner. Either way, it will not force itself on all virtual desktops. Hence, the solution is to have neither flags but to set an owner.
Add WS_EX_NOACTIVATE to the ex styles of the window.
https://learn.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles
A top-level window created with this style does not become the
foreground window when the user clicks it. The system does not bring
this window to the foreground when the user minimizes or closes the
foreground window. The window should not be activated through
programmatic access or via keyboard navigation by accessible
technology, such as Narrator. To activate the window, use the
SetActiveWindow or SetForegroundWindow function. The window does not
appear on the taskbar by default. To force the window to appear on the
taskbar, use the WS_EX_APPWINDOW style.
I am developing an MFC-based C++ application using Visual Studio 2010. There is a CToolBarCtrl with some dropdown buttons next to icons.
A user running Windows 8 has reported that they cannot see one of the icons in this toolbar. They provided a screenshot which shows that they are running Windows 8 at 150% UI zoom. My application is currently set to not be DPI-aware so this should actually not make a difference. (EDIT: apparently it does make a difference, after all - they no longer have the problem when switching to 96 DPI.)
As can be seen in the screenshots below, the toolbar dropdown buttons are much wider on their Windows installation than they should be. The spacing between the icons in the left toolbar is thus so big that the last icon cannot be seen anymore. The right toolbar in the screenshot (which does not have any dropdown buttons) appears as intended.
Mine (as it should be):
Theirs (dropdown buttons too wide):
My application already sets the icon (16x16) and button (27x24) sizes, but that obviously does not affect the dropdown button size.
So my question is: Why is it possible that the dropdown buttons can be wider than on my default Windows installation, and how can I change them to be the default size so that all icons fit into the toolbar? I didn't find any API that could actually set the toolbar dropdown button width.
Init code in my class derived from CToolBarCtrl:
SetButtonStructSize(sizeof(TBBUTTON));
SetBitmapSize(CSize(16, 16));
SetButtonSize(CSize(27, 24));
SetImageList(&icons);
SetDisabledImageList(&disabledIcons);
LONG lStyleOld = GetWindowLong(m_hWnd, GWL_STYLE);
lStyleOld |= CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT;
SetWindowLong(m_hWnd, GWL_STYLE, lStyleOld);
I have an application which has Propertysheet dialog box with PropertyPage and dialogbox has three button at the bottom.
PropertySheet and PropertyPage create using MFC CProperySheet and CpropertyPage.
Dialog box display fine in windows xp but in windows 7 its partially cut three button
Please Help me to resolve this problem
It's probably due to the font size being something other than default size (check the DPI in the Display properties). If you're manually sizing the property sheet you'll need to be aware that the dialog units will be multiplied by a factor to calculate the size for a given DPI.
Let me clarify:
Are you embedding property sheet in a dialog?
If yes:
Is there any reason to do so?
The buttons you mention belong to a dialog or property sheet?
Are you resizing property sheet?
If buttons belong to the dialog are they cut by the bottom of the dialog?
The best if you post a snapshot of the dialog from XP and 7.
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.