德尔福:气球形式与fsStayOnTop不工作在Win7中 [英] Delphi: Balloon Form with fsStayOnTop not working in Win7

查看:226
本文介绍了德尔福:气球形式与fsStayOnTop不工作在Win7中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用我自己的气球表单的应用程序。
这是一个无边界的fsStayOnTop类型窗体。

I have an application that uses my own balloon form. This is a non-bordered, fsStayOnTop kind form.

我用下面的代码展示它:

I show it with this code:

ShowWindow(Handle, SW_SHOWNOACTIVATE);
Visible := True;

今天我意识到,如果我激活另一个应用程序,那么气球不会出现!
所以它失去了它的顶级风格。

Today I realized that if I activate another application then the balloon is not appearing! So it is loosing it's stay on top style.

环境:
Win7 / x64
Delphi 6 Professional

Environment: Win7/x64 Delphi 6 Professional

我可以用它做什么?

感谢:
dd

Thanks: dd

推荐答案

在过去的顶级表单中挣扎的时候,对我而言有效:

What worked for me in the past when struggling with stay-on-top forms:

Form := TMyForm.Create(Self);
Application.NormalizeTopMosts;
SetWindowPos(Form.Handle, HWND_TOPMOST, 0, 0, 0, 0,
             SWP_NOACTIVATE + SWP_NOMOVE + SWP_NOSIZE);
Form.Show;

试试这个,而不是你的 ShowWindow 调用。这保持在所有窗口之上(你真的想要这个吗?)。此外,由于它省略了文档中说我们应该调用的 RestoreTopMosts 调用(因此应用程序中的其他保留顶部窗口将受到影响),因此它感觉有些不顺眼。所以可能会有更好的解决方案。

Try this instead of your ShowWindow call. This stays on top of all windows (do you really want this?). Also it feelds kind of hacky because it omits the RestoreTopMosts call which the documentation says we should call (so other stay-on-top windows in your application will be affected). So there might be a better solution.

这篇关于德尔福:气球形式与fsStayOnTop不工作在Win7中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆