Child window can not get keyboard after resize parent window - c++

I have used SetParent(childwindow, parentWindow) to set another window to be a screen in my app. But after my app resizes, this child window can not get any keyboard events.

Related

How to move a window after calling SetParent?

When I call SetParent() on a child window passing hWndNewParent as null, the child window now has it own window, however I can't move it anymore, and its also moved to 0x0.
Is there any window style or something else I could apply/do to make this able to move the window?
Edit:
I was able to get the window moving again by disabling the window style: WS_DISABLED and enabling WS_DLGFRAME / WS_BORDER.
Another issue: the window doesn't respond to clicks. When I click the empty area left in the parent window, the click does work in the child window, but when I click in the child window itself, the clicks don't work. They are on the same process.

Child window freeze if opened during parent window resize

I have some window. User can drag it, resize etc. At some point there can be a message that should be shown in modal window. I'm creating such a window as child and setting parent window to disabled. Everything works ok except the case when I'm dragging a parent window during the child creation. I used spy to see messages and found that in that case my child window doesn't receives WM_ENTERSIZEMOVE message. It seems that parent's WM_ENTERSIZEMOVE blocks one for child. I tried to manually send WM_EXITSIZEMOVE for the parent but unfortunatelly this doesn't works.
Send the WM_CANCELMODE message to your parent window before displaying the dialog box.
Sent to cancel certain modes, such as mouse capture. For example, the
system sends this message to the active window when a dialog box or
message box is displayed. Certain functions also send this message
explicitly to the specified window regardless of whether it is the
active window. For example, the EnableWindow function sends this
message when disabling the specified window

How to get the resize event of a parent window using its handle in child window?

I have made Browser window using mfc.
Then added it as a child of VLC player using SetParent.
I have the handle of VLC player in my child process.
Now I want to resize the child window (browser) when the VLC window is resized.
Is there any way I can get the resize event of Parent window using its handle in the child code, so I can resize the child dialog as well ?
You are thinking this the wrong way around.
Capture the event in the VLC window and in the handler set the new size for the child (browser) window.

Display child window on the screen where the parent window is located

C++
I have a modal child window that can be launched form a main window. The application runs on a Citrix server and when the user is on dual monitors, she can drag the child window to the secondary display and somehow Windows saves this position. When she moves to a workstation with a single display, she complains that the application is freezing when in reality the child window is off the screen and can be brought to the main display with some key combinations. Is there a way I can programmatically force the child window to always open on the screen where the parent window is located?
You can try calling CWnd::CenterWindow which will just position the window in the centre of the main monitor (usually above the parent window).
You should override PreCreateWindow and modify the the respective entries in the CREATESTRUCT to force the window into the visible area. Guidelines for positioning a window can be found at the MSDN ("Positioning Objects on Multiple Display Monitors").

Child window loses focus after MessageBox is displayed

So i have created a main window inside of which i have created a 2 child windows. They all have different WindowProcs. At the WM_CREATE message of the main window I am giving focus to one of the child windows with SetFocus(...). After I display a MessageBox from the child window proc the focus is set back to main window. How can I maintain focus on the child window?
When the message box window is destroyed, Windows makes another top-level window the active window. If that’s not what you want, it is up to you to respond to the WM_SETFOCUS message that your main (top-level) window will receive and use SetFocus() to direct the focus to the child.