This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Transparent window containing opaque text and buttons
I'm trying to manipulate an existing window with C++.
Basically, what I'm trying to do is set the parent window transparent via first setting its window style to WS_EX_LAYERED and then using SetLayeredWindowAttributes() with the right values.
The problem is that that will set the child windows to transparent also, which will make the whole program transparent (obviously a problem).
Any ideas?
EDIT Image demonstrating the problem:
As you might see, I set the taskbars window style to WS_EX_LAYERED, but for example the window MSTaskSwWClass (the window that has the running application icons) is also affected.
EDIT2 Tried UpdateLayeredWindow() with the exact same outcome.
As of http://msdn.microsoft.com/en-us/library/windows/desktop/ms633540%28v=vs.85%29.aspx
Windows 8: The WS_EX_LAYERED style is supported for top-level windows and child windows.
Previous Windows versions support WS_EX_LAYERED only for top-level windows.
So it will not set layered attribute to 'child' windows.
Show us screenshot and/or code.
Related
This question already has answers here:
Win32 Splitter Control
(4 answers)
Closed 3 years ago.
Using Win32 not MFC, how would I create a resizable or split controls?
As an example, a window with two edit controls side by side with the ability to resize them with a common divider. In the same way this dialog box can resized.
Not necessarily after a full example just a point in the right direction. Everything I lookup is about resizing entire windows not single controls (windows) inside the parent window.
Edit
Added image is show my example.
Everything I lookup is about resizing windows not controls.
Well, suddenly controls are, in fact, a windows as well, just visually little bit different.
Resizing controls is the same as resizing the window. In Win API it's handled by SetWindowPos function.
To properly resize controls when your window is resized you have to handle WM_SIZE Windows message in your main window and then resize/move your controls accordingly.
Updated:
After looking at your image:
Basically, if i understand your intentions, you need some custom divider/control, dragging which will eventually resize/move corresponding edit controls. Right?
In terms of pure Win API you will have to implement such control/divider in form of... another window.
In this window you will have to handle mouse clicks/moves and then do whatever you want with the (somehow) linked edit controls (basically implement all the logic).
Frankly saying this is not a very trivial task and that is what frameworks are here for (MFC, etc...).
How to minimize a frameless window which has been set size to fixed by method setFixedSize in Qt?
Hi,
I'm using C++ code to make a Qt application. I set the window to frameless by
this->setWindowFlags(Qt::FramelessWindowHint);
So I can't click the minimize button support by Operating System and I made a customed one. But, when I want to use
this.showMinimized();
I found that it can't work with window which has been set fixed size by
this.setFixedSize(width, height);
So my question is, is there some other ways to make the window minimized which can be used by a window that set fixed size?
This is almost definitely not what you are looking for, but most if not all modern operating systems contain a minimize-all keyboard shortcut or show desktop button. You may have the button on your task bar, if you have one. If not, try windows-key+d or control-alt-d. If you want to learn about how to minimize a qt window from within your code(what I think you probably want), I recommend you check out the surprisingly clear documentation at doc.qt.io.
Please take a look at this screenshot:
As you can see, the "Executable modules" and "Threads" child windows are free to roam about in the sandbox-like "Themida" parent window, and if they get dragged past the edge the overflow simply gets hidden. How can I create this effect?
That is a Multiple Document Interface (MDI) application. The containing window, with the dark grey background is the MDI client window, and the windows inside are the MDI child windows.
The use of MDI has been discouraged by Microsoft for many years so you may wish to think twice about using it in a new application.
Simply set the window style to WS_CHILD, and the window will be confined in the parent client rectangle.
You can do this during window creation, or after using SetWindowLongPtr() and GetWindowLongPtr():
SetWindowLongPtr(hwnd, GWL_STYLE, WS_CHILD | GetWindowLongPtr(hwnd, GWL_STYLE));
P.S. You don't need to create an MDI application to have this behavior.
This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
How to set default font for all the windows in a Win32 Application?
Which Font is the default for MFC Dialog Controls?
I hate default Windows Api Window Font (it is the default system font , i think). I know how to change the font of an individual child, say a button. But isn't there a way to change the font of the entire application so that I don't have to use SendMessage(...WM_SETFONT) on every single widget in my program?
Code examples are welcomed. (I am using C++)
One way would be to use EnumChildWindows:
BOOL CALLBACK SetChildFont(HWND hwndChild, LPARAM lParam)
{
HFONT hFont = (HFONT)lParam;
SendMessage(hwndChild, WM_SETFONT, (WPARAM)hFont, TRUE);
}
EnumChildWindows(hwndParent, SetChildFont, (LPARAM)hFont);
I explain all of this in quite a bit of depth here: Which Font is the default for MFC Dialog Controls? Definitely required reading for any Win32 developer who cares about getting the UI right.
There's no way to set the font for an entire application. The best thing you can do is set the font for a parent window and take advantage of the fact that most controls will inherit their font from their parent. To make extra sure that this works, you can write your own simple SendMessageToChildren function like MFC offers, which just walks down through the children of a particular parent recursively and sends each of them the WM_SETFONT message.
But WM_SETFONT is really your only option here. You can't set a font for an entire class like you can a background brush. Getting this right can be challenging, but I agree that it is a very important to try. The hallmark of an inconsistent UI and an unprofessional application is one that does not use the correct default GUI font. Windows Vista came along and complicated things even further by switching not only the face to Segoe UI, but the default size to 9 point.
I am designing a UI engine that needs to render into popup (WS_POPUP) windows. As these windows cannot be children of other windows, each instance is given its own taskbar icon.
I need a way to prevent the taskbar icons from appearing for certain windows that are created as "dialogs". I cannot use an OS-provided dialog because they all have frames (and I can't figure out how to render into them) or a tool-created custom dialog (which seem to require the CLR).
I am not an expert with the windows API and I feel that I have missed something obvious...
Also: Anything involving CLI/CLR is not an option.
EDIT:
The WS_EX_NOACTIVATE style can be used for this purpose as well, though the activation behavior would need to be emulated by the program.
If you set the WS_EX_TOOLWINDOW extended style for your window, it won't be shown in the task bar or Alt+Tab list. This does cause the window to be rendered slightly differently, however (thinking floating tool palette).