服务应用程序太明显
在 Delphi 5 中开发一个服务应用程序,该应用程序旨在在 Windows XP - 7 上运行。该应用程序的大部分都很好地组合在一起,但我遇到了一个问题。该服务应用程序的一部分是偶尔显示数据的表单(类似于 Avast 用于让您知道其更新的滑块框)。当服务显示表单时,表单会显示在任务栏上,但我们不希望如此。有人对如何隐藏任务栏上的表单按钮有任何建议吗?到目前为止,我发现的常规应用程序的标准方法都不起作用。谢谢。
Working on a service application in Delphi 5 that is intended to run on Windows XP - 7. Most of the application is coming together nicely, but I'm running into one issue. Part of this service application is a form that displays data occasionally (similar to the slider box Avast uses to let you know its updated). When the service shows the form, the form displays on the taskbar, but we don't want it to. Does anyone have any suggestions as to how to hide the form's button on the taksbar? None of the standard methods I've found for regular applications have worked so far. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来好像您设想有一个通知区域图标(也称为系统托盘图标)来通知用户有关服务的事件/与服务相关的事件。
您需要将服务的 GUI 方面与服务本身分开,并使用某种 IPC 来允许托盘图标小程序根据需要与服务进行通信。根据 IPC 的需求,这可能是命名管道、对内存映射文件的共享访问或更复杂的东西。
然后,用于管理 GUI 与任务栏的行为的技术应该按预期工作。
It sounds as if you envisage having a notification area icon (a.k.a. system tray icon) to inform the user about events in/relating to the service.
You need to separate this GUI aspect of your service from the service itself and use some sort of IPC to allow the tray icon applet to communicate with the service as required. Depending on the needs of your IPC this could be a named pipe, shared access to a memory mapped file or something more sophisticated.
Then the techniques for managing the behaviour of the GUI w.r.t the taskbar should work as expected.
重写表单的
CreateParams
方法并将WS_EX_TOOLWINDOW
值添加到Params.ExStyle
字段。这会将其标记为工具窗口,该窗口没有任务栏条目。Override the form's
CreateParams
method and add theWS_EX_TOOLWINDOW
value to theParams.ExStyle
field. That will flag it as a tool window, which won't have a taskbar entry.在 http://delphi.about 上找到此内容。 com/od/adptips1999/qt/hidefromtaskbar.htm
使用 Delphi 2007,要隐藏任务栏按钮,您需要几行代码:
将 MainFormOnTaskBar 设置为 FALSE
在主窗体的 OnShow 事件处理程序调用
内 在主窗体的 OnActivate 内事件处理程序调用
Found this on http://delphi.about.com/od/adptips1999/qt/hidefromtaskbar.htm
With Delphi 2007, to hide the taskbar button you'll need a few code lines:
Set MainFormOnTaskBar to FALSE
Inside the main form's OnShow event handler call
Inside the main form's OnActivate event handler call