C++ docking windows - c++

is there any way to dock two windows(like Winamp does with panels), but one window is from my application(WinApi) and second is from other(not connected with my app) application? So if I move window from other app my window will "glue" with it and move same direction.

Yes, that's fairly easy. Use SetWindowsHookEx(WH_CALLWNDPROCRET, otherHWND) to get the WM_MOVE message that will be generated whenever otherHWND moves.

I don't know if this is possible in C++ because I program in C# but what you could try is:
Make 2 panels.
Dock panel2 to the bottom.
dock panel1 to fill.
Place a splitter above panel2 so it can be resized.
I've used this solution before and it worked pretty well :).

Related

How to create a borderless window with titlebar in windows c++

I am trying to create a Direct3D app that is operating in windowed mode with a title bar and minimize/quit button. However, I'd really like to be able to axe the border around the window.
I am looking to do this because it looks pretty cheesy on dual monitors when the app is filling the primary monitor horizontally (with room to move the app vertically), but its window border overflows onto the secondary screen. I've tried a bunch of combinations of setwindowlong with GWL_STYLE and GWL_EXSTYLE, but can't seem to make headway unless I disable the title bar.
I've seen a bunch of apps that are borderless however they seem to emulate the title bar rather than using the built in one provided by Microsoft.
Thanks for any suggestions.
You can't remove the border and keep the titlebar AFAIK.
You can reimplement the titlebar by using WM_NCHITTEST but you still need to draw it yourself which would not be a bad idea if you want your D3D app to look its best.
Visual Studio, last time I checked, achieves its border with transparent layered windows standing behind the primary one. They are the shadows you see.

Constraining other application's window sizes through Qt Application

I'm looking for a way in Qt to constrain other application window's (some will not be Qt) so that when maximized don't overlap my Qt application. Essentially I want to create the Windows Taskbar. I'd like the applications edge to dock to the appropriate edge of my Qt Taskbar in the same way that applications dock to the Windows taskbar when they are maximized. I envision this taskbar to exist along the top edge of the screen, but would like to allow users to decide which edge it will live on.
I know it isn't hard to make a window that is always on top it's more the auto docking issue I'm having a hard time figuring out.
I'm right now only looking to accomplish this on Windows.
Thank for any help.
Detailed explanation on how to do it would be too long for an answer here, but MSDN documentation on SHAppBarMessage should get you started. Taskbar created like that can even be part of winows taskbar ;)

Qt Custom Window

Pardon me, I am a newbie :)
Is it possible in Qt to create a custom window without borders but still draggable without holding down the Alt Key? I created a borderless window but in order to be able to drag it (on Linux) you have to hold down the alt key.
I was planning to create a window with rounded corners. Any one have any idea how to make this possible? Although, I think implementing the mouseMove, mousePress or something is a possible solution but I need some other solution.
Thanks
There is just one way to make the window manager move the window: Add a drag bar. If there is no drag bar, then your app must move the window itself by setting the new position (i.e. you must handle the mouse click+move events yourself).
The feature to move the window by pressing Alt is also a function of your window manager, not Qt.
Yes, there is a rounded window example somewhere using a clock which does this. Basically, you need to manage the mouse clicks yourself as Aaron says.
You may use QDecoration (for Embedded Linux) to make it: here is the example.
Detect that the mouse is held down on your window, then grab the events for the mouse moving around so you can move your window in sync with it. When user releases mouse button your task is over.

How do I make tab control take over entire window in Qt Creator?

I want a tab control to "dock" to the entire window panel, in Qt Creator. Now in Winforms and WPF this is super easy but in Qt its not working.
I've tried all the layouts, grid layouts, etc etc. it's just shrinking the tabs not making them grow to fill. So please test a solution before telling me what the SHOULD BE OBVIOUS answer is cause its not working.
omg QQ this is driving me NUTS
I'm unsure what you are trying to achieve here - do you want the control to fill the client area? Are you creating a QMainWindow-derived class or a QDialog-derived one? If using QMainWindow then you'd make the tab control the central widget by calling setCentralWidget. The tab control will then fill the main window's client area. I have done this many times.
Or do you want the tab 'ears' to stretch?

Dock a control in native C++

I know how to do this in .Net but in native Win32, how does one dock a control. I'm trying to dock a trackbar I made like vlc's trackbar.
Thanks
dock it to the bottom of its parent window
You write the code to do it, or use a library which provides that functionality. If you are intent on using raw Win32, handle the WM_SIZE message for the container, calculate where the trackbar should be, and put it there. Roughly (0,height-trackbar_height,width,trackbar_height).
Apparently, Pearl Jam are still touring.