I\'m trying to embed a window from my process into the window of an external process using the SetParent function and have encountered a few problems that I
I ran into the same issue, after reading MSDN doc carefully, I found it an easy fix.
You should remove WS_POPUP and add WS_CHILD BEFORE you call setParent
It's stated in MSDN:
For compatibility reasons, SetParent does not modify the WS_CHILD or WS_POPUP window styles of the window whose parent is being changed. Therefore, if hWndNewParent is NULL, you should also clear the WS_CHILD bit and set the WS_POPUP style after calling SetParent. Conversely, if hWndNewParent is not NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the WS_CHILD style before calling SetParent.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633541(v=vs.85).aspx