SetParent
1、http://bbs.csdn.net/topics/390672855
该帖子中 第15楼:
“
MSDN里面说了:
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.
就是如果你原来是主窗体要修改style为WS_CHILD的
”
ZC: 查了下MSDN,并尝试了一下,确实需要将 子窗口的 风格WS_POPUP去掉,并 加上WS_CHILD 。
2、
SetWindowLong (https://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).aspx)
ZC: 参考代码:
QWebView *pWV = new QWebView(); pWV->show(); pWV->load(QUrl::fromUserInput("www.163.com")); HWND hWndChild = (HWND)pWV->winId(); LONG lStyle = GetWindowLong(hWndChild, GWL_STYLE); lStyle = lStyle & (~WS_POPUP) | WS_CHILD; SetWindowLong(hWndChild, GWL_STYLE, lStyle); HWND hWndNewParent = (HWND)854776; SetParent(hWndChild, hWndNewParent);
Z