开发者

I can use SetWindowPos to place the window behind another window, but how do I place it in front of a given window?

SetWindowPosition second parameter is hWnd开发者_开发知识库InsertAfter which means behind. How do I place a window in front of another (above)?


How about you call SetWindowPos again, swapping the hwnd parameters (so your original window is now the hWndInsertAfter, and the initial hWndInsertAfter is now the hWnd you're moving), and passing in the SWP_NOMOVE flag?

Edit: And if the exact position in the Z-order doesn't matter and you just want it in front, don't forget about SetForegroundWindow.


if the z-order looks like that:

z-oder -> desktop_window-> window a -> window b

and you want to set your window above window a, set hWndInsertAfter to window b, if you want to set your window above window b, use the HWND_TOP flag

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜