关于windows服务的一个简单问题

gaoxiaofei 2003-10-16 01:57:35
我用vb.net做了一个windows服务,服务的描述项目为空,请大家告诉我描述应该在哪里写,谢谢!
...全文
102 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
gaoxiaofei 2003-10-17
  • 打赏
  • 举报
回复
大侠大恩大德小男子无以回报,只有用微不足道的分数来表达我难以表达的谢意 :)
gaoxiaofei 2003-10-16
  • 打赏
  • 举报
回复
谢谢,我去试试看,我以为只是在服务的属性中添加,不好意思,辛苦了。:)
Montaque 2003-10-16
  • 打赏
  • 举报
回复
呵呵,好像没有简单的办法.

这些描述其实都在注册表中.你可以这样做

在你的服务项目中添加一个installer.然后重写install 事件:

imports Microsoft.win32


Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)

'First do the install
MyBase.Install(stateSaver)

Dim SK As RegistryKey, CCSK As RegistryKey
Dim SSK As RegistryKey, DK As RegistryKey
'Navigate to the correct registry key
SK = Registry.LocalMachine.OpenSubKey("System")
CCSK = SK.OpenSubKey("CurrentControlSet")
SSK = CCSK.OpenSubKey("Services")
DK = SSK.OpenSubKey(Me.ServiceInstaller1.ServiceName, True)

'Now we can set the service description
DK.SetValue("Description", "This Is A Service developed By Montaque")

'Cleanup

DK.Close()
SSK.Close()
CCSK.Close()
SK.Close()

End Sub

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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