gpt4 book ai didi

windows - SetWindowPos 如何影响所有者窗口的 Z 顺序?

转载 作者:行者123 更新时间:2023-12-03 11:05:00 55 4
gpt4 key购买 nike

The SetWindowPos function接受以下标志:

SWP_NOOWNERZORDER (0x0200)
Does not change the owner window's position in the Z order.

做什么 SetWindowPos函数对所有者窗口在Z顺序中的位置,如果你不传递这个标志?

最佳答案

What does the SetWindowPos function do to the owner window's positionin the Z order, if you do not pass this flag?

以将拥有的窗口放在 Z 顺序的底部为例。共有三个窗口:Owned、TestWindowPos(所有者)和 New Tab Chrome 窗口(作为引用)。

测试代码片段:

   HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);

HWND hWndOwned = CreateWindowW(szWindowClass, L"Owned", WS_OVERLAPPEDWINDOW,
0, 0, 500, 500, hWnd, nullptr, hInstance, nullptr);

ShowWindow(hWndOwned, nCmdShow);
UpdateWindow(hWndOwned);

SetWindowPos(hWndOwned, HWND_BOTTOM, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER);

当设置 SWP_NOOWNERZORDER 标志时,您可以从以下快照中看到,它将拥有的窗口置于底部但保持所有者不变。

enter image description here

SWP_NOOWNERZORDER 标志为 设置时,您可以从以下快照中看到 它会更改拥有窗口的 z 顺序以及所有者窗口的.

enter image description here

关于windows - SetWindowPos 如何影响所有者窗口的 Z 顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62639253/

55 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com