您的位置:学习中国 推荐教程 VB编程 正文
原作者:kuku 添加时间:2007-06-02 原文发表:2007-06-02 人气:44 来源:互联网

本文章共28074字,分19页,当前第6页,快速翻页:
 
-----------------------------------------------------------------------------------------------------------------------------------------------

本文提示:《vb.net例程集锦(6)》是本站编辑们为广大网友精选的实用文章,本文阐述了关于文章的相关理论,相对来说专业性强,但是本文只是针对于某个问题提出的见解与论述,未必能辐射到相关问题的方方面面,所以本文处理问题的方法仅仅为您提供一些参考。更多问题请查阅学习中国网其他栏目哦.

-----------------------------------------------------------------------------------------------------------------------------------------------


mobContextMenu.MenuItems(3).Enabled = False
Case ServiceProcess.ServiceControllerStatus.Stopped
mobNotifyIcon.Icon = New Icon(\"Stopped.ico\")
mobContextMenu.MenuItems(0).Enabled = False
mobContextMenu.MenuItems(1).Enabled = False
mobContextMenu.MenuItems(2).Enabled = False
mobContextMenu.MenuItems(3).Enabled = True
Case _
ServiceProcess.ServiceControllerStatus.ContinuePending, _
ServiceProcess.ServiceControllerStatus.PausePending, _
ServiceProcess.ServiceControllerStatus.StartPending, _
ServiceProcess.ServiceControllerStatus.StopPending
mobNotifyIcon.Icon = New Icon(\"Paused.ico\")
mobContextMenu.MenuItems(0).Enabled = False
mobContextMenu.MenuItems(1).Enabled = False
mobContextMenu.MenuItems(2).Enabled = False
mobContextMenu.MenuItems(3).Enabled = False
End Select
\'//检查“暂停”和“继续”使用可用
If mobServiceController.CanPauseAndContinue = False Then
mobContextMenu.MenuItems(1).Enabled = False
mobContextMenu.MenuItems(2).Enabled = False
End If

Catch obEx As Exception
Throw obEx
End Try
End Sub

下面建立菜单项的事件处理程序:

\'//停止服务的过程
Private Sub StopService(ByVal sender As Object, ByVal e As EventArgs)
Try
If mobServiceController.Status = ServiceProcess.ServiceControllerStatus.Running Then
If mobServiceController.CanStop = True Then
mobServiceController.Stop()
End If
End If
Catch obEx As Exception
Throw obEx
End Try
End Sub

\'//暂停服务的过程
Private Sub PauseService(ByVal sender As Object, ByVal e As EventArgs)
Try
If Not mobServiceController.Status = ServiceProcess.ServiceControllerStatus.Paused = True Then
If mobServiceController.CanPauseAndContinue = True Then
mobServiceController.Pause()
End If
End If
Catch obEx As Exception
Throw obEx
End Try
End Sub

\'//继续服务程序的过程
Private Sub ContinueService(ByVal sender As Object, ByVal e As EventArgs)
Try
If mobServiceController.Status = ServiceProcess.ServiceControllerStatus.Paused = True Then
If mobServiceController.CanPauseAndContinue = True Then
mobServiceController.Continue()
End If
End If
Catch obEx As Exception
Throw obEx
End Try
End Sub

\'//开始服务程序的过程
Private Sub StartService(ByVal sender As Object, ByVal e As EventArgs)
Try
If mobServiceController.Status = ServiceProcess.ServiceControllerStatus.Stopped Then
mobServiceController.Start()
End If
Catch obEx As Exception
Throw obEx
End Try
End Sub

\'//“关于”菜单项的过程
Private Sub AboutBox(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim obStringBuilder As New StringBuilder()
With obStringBuilder
.Append(\"Service Controller 使用例子\")
.Append(vbCrLf)
.Append(\"CLR 版本:\")
.Append(Environment.Version.ToString)
MsgBox(.ToString, MsgBoxStyle.Information)
End With
obStringBuilder = Nothing
Catch obEx As Exception
Throw obEx
End Try
End Sub

\'//退出服务程序的过程
Private Sub ExitController(ByVal sender As Object, ByVal e As EventArgs)
 
本文章更多内容<<上一页 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 下一页>>
本页地址
收藏到:[收藏夹] [百度搜藏] [新浪ViVi] [POCO网摘] [ 和讯网摘] [好哦网摘] [Google书签]
               
[搜狐网摘] [365Key网摘] [天极网摘] [我摘] [博采网摘] [igooi网摘]
相关文章

在VB.NET中获得功能加强的分类和查询数组
解析Visual Basic.NET事件编程
VB.NET中对象的克隆
VB.Net编程入门之Hello World 入门篇
VB 神童教程第二章第九节——综合示例三
VB 神童教程第二章第八节——组合框控件
VB 神童教程第二章第七节——列表框控件
VB 神童教程第二章第六节——综合示例二
VB 神童教程第二章第五节——单选与复选控件
VB 神童教程第二章第四节-CommandButton控件
向SQL Server数据库添加图片和文字
多个窗体之间如何互相调用
如何拖动没有边框的窗体?
怎么让窗体透明后,控件不透明?
Video/ Audio压缩数据流播放技术
VB程序中处理随机事件
VB编程的必备技巧
VB6制作Win98风格的工具栏
VB实现窗口的弹出式菜单
用VB6实现动态增减控件

相关评论


本文章所属分类:首页 推荐教程 VB编程   VB编程