如何最小化任务栏窗口? (即不图标化)
我有一个想要最小化的窗口(到任务栏),所以我调用 ShowWindow
:
ShowWindow(Handle, SW_MINIMIZE);
除了窗口不是最小化自身(到任务栏),而是图标化 :
窗口没有父子关系:
如何最小化任务栏窗口?
更新:
遵循 2002 年的一些建议,我尝试设置 WS_EX_APPWINDOW
窗口样式和/或确保窗口没有所有者:
不幸的是,这改变了我的(Delphi)应用程序的行为,因为我的应用程序现在有两个任务栏图标,而不是一个:
这当然是 Delphi 的产物 (5);因为我试图解决另一个问题。
但这不应该影响这个问题。我正在调用 ShowWindow(..., SW_MINIMIZE)
API,Windows 不是最小化窗口,而是图标应用程序。
如何最小化任务栏窗口?
i have a window that i want to minimize (to the taskbar), so i call ShowWindow
:
ShowWindow(Handle, SW_MINIMIZE);
Except that rather than minimizing itself (to the taskbar), the window is iconified:
The window is unparented:
How do i minimize a window to the taskbar?
Update:
Following some advice from 2002, i try setting the WS_EX_APPWINDOW
window style and/or ensuring the window has no owner:
Unfortunately, that changes the behavior of my (Delphi) application because there is now two taskbar icons for my application, rather than one:
This, of course, is an artifact of Delphi (5); and because i was trying to solve another issue.
But that shouldn't affect this question. i'm calling the ShowWindow(..., SW_MINIMIZE)
API, and rather than minimize the window Windows is iconifying the application.
How do i minimize a window to the taskbar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
任务栏上的图标是应用程序(句柄)的图标,而不是 MainForm 的图标。
使用:
编辑:但是从您的两个链接中,我知道您已经知道了...duh;)
这适用于MainForm:
并从任务栏中隐藏Application.Handle(仅具有一个MainForm 的任务栏图标):将此表单的
Visible
属性设置为True
并隐藏项目文件中的应用程序:对于此表单,
ShowWindow(Handle, SW_MINIMIZE);
应该可以工作。它还在最小化或恢复时提供 Windows 的默认缩放功能。(在 XP 和 W7 上使用 D5 和 D7 进行测试)
That icon on the taskbar is the icon of the Application (Handle) rather than that of the MainForm.
Use:
Edit: But out of both your links, I understand you knew that already...duh ;)
This works for the MainForm:
And to hide Application.Handle from the taskbar (to only have a taskbar icon for the MainForm): set the
Visible
property of this Form toTrue
and hide the Application in the project file:For this form,
ShowWindow(Handle, SW_MINIMIZE);
shóuld work. It also provides for the default zooming-feature of Windows when minimizing or restoring.(Tested with D5 & D7 on XP and W7)
一个超级简单的解决方案是禁用 FORM 上的最小化图标
[对象检查器]-[表单属性]-[边框图标]-[biMinimize]
仍然可以通过单击任务栏上的应用程序图标来最小化和恢复应用程序
A super simple solution is to disable the minimize icon on the FORM
[Object inspector]-[Form properties]-[Border icons]-[biMinimize]
The application can still be minimized and restore by clicking on the APPLICATION icon at the taskbar