避免应用程序激活和在单击按钮上时的重点 - Windows API或Qt [英] Avoid application activation and focus in when clicking buttons on it - Windows API or Qt
问题描述
情况:无边框的QDialog在其他应用程序之上保持成功。
问题是当点击这个总是在顶层的应用程序窗口时,以下
- 点击的始终在线的应用程序已激活
- 当前应用程序不会松动激活和聚焦
- 仍然能够与始终在顶的应用程序交互(点击按钮或下拉菜单,拖动窗口)?
-
Qt :: WindowDoesNotAcceptFocus
但不起作用:始终在顶的应用程序已激活,集中。 -
Qt :: WindowTransparentForInput
,始终在顶应用程序对点击是真的透明的:未激活和不专注,但不幸的是, 使用Windows标志( - The clicked always-on-top application gets activated
- The clicked always-on-top application window steals the focus of previous active/focused app
- the current application does not loose activation and focus
- while user being still able to interact with the always-on-top application (hitting buttons or drop-down menus, dragging the window)?
Qt::WindowDoesNotAcceptFocus
but it does not work: the always-on-top application is activated, focused.Qt::WindowTransparentForInput
, the always-on-top application is really transparent to clicks: not activated and not focused in but buttons are unfortunately not triggered when hit.
有可能当点击这个总是在顶部的应用程序窗口时,无效和未聚焦的应用程序窗口,
我正在使用Qt,但使用本机Windows API没有问题。
我试过下面的Qt windowFlag:
#include< qt_windows.h>
)。在创建并显示窗口后,必须使用以下内容: HWND winHandle =(HWND)winId
ShowWindow(winHandle,SW_HIDE);
SetWindowLong(winHandle,GWL_EXSTYLE,GetWindowLong(winHandle,GWL_EXSTYLE)
| WS_EX_NOACTIVATE | WS_EX_APPWINDOW);
ShowWindow(winHandle,SW_SHOW);
Situation: A border-less QDialog stays successfully on top of other applications.
The problem is when clicking on this always-on-top application window, the following occurs:
Is there a possibility that when clicking on this always-on-top inactive and unfocused application window,
I'm working with Qt but there's no problem about using native Windows API.
I tried the following Qt windowFlag:
It is possible to make a window unactivable and unfocusable when clicking on it by using Windows flags (#include <qt_windows.h>
). The following has to be used after the window is created and shown:
HWND winHandle = (HWND)winId();
ShowWindow(winHandle, SW_HIDE);
SetWindowLong(winHandle, GWL_EXSTYLE, GetWindowLong(winHandle, GWL_EXSTYLE)
| WS_EX_NOACTIVATE | WS_EX_APPWINDOW);
ShowWindow(winHandle, SW_SHOW);
这篇关于避免应用程序激活和在单击按钮上时的重点 - Windows API或Qt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!