在Delphi中使其他应用程序窗口半透明
美好的一天,
我在网上搜索了有关这是否可行的任何指示,但无济于事。我需要编写一个应用程序,允许我选择另一个应用程序,并通过这样做使所选应用程序半透明并位于顶部(就像重影图像覆盖一样)。
Delphi 可以做到这一点吗?我正在使用 Delphi XE 和 Lazarus。如果有人能指出我从哪里开始的大致方向,我将非常感激。
提前致谢,
Good Day all
I searched the web for any directions as to if this is possible but to no avail. I need to write an application that will allow me to select another application and by doing so make the selected application translucent and on-top (like a ghost image overlay).
Is this at all possible with Delphi? I am using Delphi XE and Lazarus. If anybody could just please point me in the general direction of where to start I will be much obliged.
Thanks in advance,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以执行此操作,但不推荐,因为这种行为必须由自己的应用程序处理。无论如何,如果您坚持这样做,因为您有充分的理由这样做,这里我留下设置窗口透明度和将窗口设为最顶部的代码,只是为了展示如何完成。
透明度
您必须使用
SetWindowLong
函数,带有WS_EX_LAYERED
标志和SetLayeredWindowAttributes
函数与LWA_ALPHA
设置透明度。将 Windows 设置为最上面
您必须使用
SetWindowPos
函数传递HWND_TOPMOST
值,该值将窗口置于所有非最顶层窗口之上。即使窗口被停用,它也会保持其最顶层的位置。You can do this but is not recommended, because this kind of behavior must be handled by the own application. anyway if you insist because do you have a very good reason to do this, here i leave the code to set the transparency of a window and Make a windows Top Most, just to show how can be done.
Transparency
you must use the
SetWindowLong
function with theWS_EX_LAYERED
flag and theSetLayeredWindowAttributes
function withLWA_ALPHA
to set the transparency.Make a windows Top Most
You must use the
SetWindowPos
function passing theHWND_TOPMOST
value which places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.Windows 可以做到这一点,但应用程序无法稳健地做到这一点。
Windows can do this but an app has got no hope of doing this robustly.