1

任何想法如何使用 SetParent()?

以下似乎不起作用:

fhWnd = FindWindow(_T("Notepad"), NULL);

hWnd = CreateWindowEx(WS_EX_TOPMOST , _T("test"), _T("test"),
        WS_POPUP,
        20, 20, 400, 400, NULL, NULL, hInst, NULL);

 SetParent(hWnd, fhWnd);

 DWORD style = GetWindowLong(hWnd, GWL_STYLE);
 style = style & ~(WS_POPUP);
 style = style | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
 SetWindowLong(hWnd, GWL_STYLE, style);
 SetWindowLong(fhWnd, GWL_STYLE, GetWindowLong(fhWnd, GWL_STYLE) | WS_CLIPCHILDREN);

使用上面的代码,我必须将父窗口移出屏幕并再次移回,以便查看子窗口上绘制的内容。

知道我做错了什么吗?

4

0 回答 0