how to create window child window outside primary window - winapi

I've learned how to create a child window within the parent window, but I want to create a window outside the program's primary window. If I'm not mistaken, a window outside the primary one is still a child window, right? Does it have its own class that needs to be registered? I tried just making another window, but changing the arguments. I got some interesting results, but not a separate window.

Related

Stop a sheet from making a window the main/key window

I have two windows in my application (document based), a main and secondary window. I want to keep the secondary window behind the main window unless the user clicks on it or the main window decides to show it (via a user pressed button).
The issue is that the secondary window has a modal sheet which makes it come to the foreground. I want to stop it from doing that.
Current solution:
Before the sheet appears I increase the main window's level by 1
After the sheet is done I decrease the main window's level by 1
Problems:
My timing of knowing when these sheets occur is bad and unreliable
The window flickers a bit
Notes:
I have tried making the secondary window a child window of the main one, however this links them too strongly, where dragging one drags the other and I do want the secondary window to surface when the user clicks on it.

How to keep child window always on top of its parent on mac os

As the title says, I found difference between windows and mac os.On windows, the child window is always on top of its parent like this QWidget *child = new QWidget(parent);. But the difference on mac os, when I clicked the parent window, it raise to the top, and it cover the child window.
So, I want to keep the child window always on top of the parent window, and the effect like windows.
I have tried to set the child windowflag to "Qt::tool","Qt::WindowStaysOnTopHint",but it's not I wanted. It prevents me from clicking other windows or dialogs.
Forgive my poor English.Thanks.

What exactly is a top-level window in win32 programming?

I don't quite understand what the difference between a window that I create via CreateWindowEx and a "top-level" window.
What is a top level window in win32 programming?
The MSDN entry About Windows offers the following definition:
A window that has no parent, or whose parent is the desktop window, is called a top-level window.
A more practical explanation is given in the blog post A window can have a parent or an owner but not both:
A window can be created as a child window (WS_CHILD set) or a top-level window (WS_CHILD not set).
A top-level window is a window that is not a child window, or has no parent window (which is the same as having the "desktop window" as a parent).

Display text name of child instead of parent on Windows Mobile application

I have a vb.net application that uses ShowDialog() to open child screens.
Long story short, I had issues with focusing the control if I opened IE on top of my program without minimizing the program. Once I reactivated my program and closed a child window, IE would show again instead of my program. I fixed this by setting the owner of my form.
Now I have another issue. After setting the owner, the parent (text) name of my form is now being shown at the top of the application when a child screen is open instead of the parent name. How can I fix this to show only the child's text form name when a child screen is open?
I tried several things like trying to set the name of the parent's text property.
The only way I could get this to work was by removing the line where I set the owner of my child control, and after the showDialog, setting the parent focus to true:
form.ShowDialog()
Me.Visible = True

What are the Win32APIs corresponding to the "Parent" and "Owner" Window values displayed by MS Spy++?

I'd like to obtain the same values via code. However I'd like to obtain the top-most or root windows in the hierarchy
I seem to have got the Root Parent with
HWND rootWinHandle = GetAncestor(activatedWinHandle, GA_PARENT);
However I can't get the owner window correctly. Tried
HWND rootOwnerWinHandle = GetAncestor(activatedWinHandle, GA_ROOTOWNER);
For a particular modeless dialog, Spy++ returns the Main Exe window whereas the above line returns the input i.e. activatedWinHandle. Am I looking at the wrong api ?
I'd like to obtain this without MFC if possible... coz nothing else in my project requires it.
See the GW_OWNER flag for GetWindow.
The GetParent documentation states:
If the window is a child window, the return value is a handle to the parent window. If the window is a top-level window, the return value is a handle to the owner window.
Try GetParent(). I believe this will return the owner window of a window without the WS_CHILD style, and the parent window of a window with WS_CHILD.
Only bit of insight i can add it from Raymond Chen:
Remember that owner and parent are two
different things.
Modal dialogs disable their OWNERs.
All top-level windows have the desktop
as their PARENT.
From: What's so special about the desktop window?
Special demo (+src):
http://files.rsdn.ru/42164/parentowner.zip
screenshot: http://files.rsdn.ru/42164/parentowner.png
kero

Resources