windows下如何将自己的窗口放到其他某个窗口的前面?

danxuezx 2018-06-23 08:48:28
具体想要实现的效果是这样的:
自己程序有个半透明窗口,现在想在用户打开任何其他窗口时,我都会创建一个跟它一样大小的窗口放到它前面。当用户切换窗口时,我创建的这个窗口也切换到它的前面。

大家有什么思路没。

我尝试通过setwindowpos 并不能精确的把某个窗口放到其他窗口前面。
...全文
361 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
danxuezx 2018-06-24
  • 打赏
  • 举报
回复
引用 1 楼 zgl7903 的回复:
切换时把你的窗口先置前, 再把目标窗口置到你窗口后面

SetWindowPos(
HWND hWnd, // 目标窗口
HWND hWndInsertAfter, // 你的窗口

感谢,我少做了一个动作,把自己放到最前面。我去实验一下。
schlafenhamster 2018-06-23
  • 打赏
  • 举报
回复
GetForegroundWindow
The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.

后 改变 半透明 窗口的 父窗口,调整半透明 窗口位置
zgl7903 2018-06-23
  • 打赏
  • 举报
回复
切换时把你的窗口先置前, 再把目标窗口置到你窗口后面

SetWindowPos(
HWND hWnd, // 目标窗口
HWND hWndInsertAfter, // 你的窗口

15,978

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧