点击托盘图标,怎么知道主窗体被其他窗体遮住了,从而前端显示,像金山词霸一样,谢谢

开始领悟 2004-01-06 06:45:22
如题
...全文
57 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
COpyFRee 2004-02-01
  • 打赏
  • 举报
回复
如 pazee 所说,直接 Application->BringToFront(); 就行了,不过你若非想知道是否在最上就这样吧:

if (GetForegroundWindow() != Application->Handle)
{
SetForegroundWindow(Application->Handle);
//或
Application->BringToFront(); //这两条语句任选其一即可
}
lvjack 2004-01-31
  • 打赏
  • 举报
回复
如果一定要知道就用GetForegroundWindow
看看是不是自己的窗体好了
lvjack 2004-01-31
  • 打赏
  • 举报
回复
同意一楼,另外可以用SetForegroundWindow

The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user.

BOOL SetForegroundWindow(

HWND hWnd // handle of window to bring to foreground
);


Parameters

hWnd

Identifies the window that should be activated and brought to the foreground.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The foreground window is the window at the top of the Z order. It is the window that the user is working with. In a preemptive multitasking environment, you should generally let the user control which window is the foreground window. However, an application can call SetForegroundWindow if it wants to put itself into the foreground to display a critical error or information that requires the user's immediate attention. A good example is a debugger when it hits a breakpoint.

The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.

See Also

GetForegroundWindow
开始领悟 2004-01-31
  • 打赏
  • 举报
回复
没有说到问题的关键
CityHost 2004-01-17
  • 打赏
  • 举报
回复
支持一下,学习学习
dclman 2004-01-15
  • 打赏
  • 举报
回复
顶一个
sun_wyz 2004-01-15
  • 打赏
  • 举报
回复
判断当前窗口是不是在最上层就行了
开始领悟 2004-01-15
  • 打赏
  • 举报
回复
怎么判,不行啊
goneaway1981 2004-01-07
  • 打赏
  • 举报
回复
同意1楼。

二楼是不是说建议楼主的昵称改为:“冰聪明雪”?? : )
geniusdhc 2004-01-07
  • 打赏
  • 举报
回复
判断是否被激活就差不多了.
constantine 2004-01-06
  • 打赏
  • 举报
回复
有道理。
另外,建议楼主把倪称加多两个字:“聪明”,^_^
耙子 2004-01-06
  • 打赏
  • 举报
回复
管他挡不挡住,你都 Application->BringToFront(); 就得了

1,317

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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