⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 services.frm

📁 不错的一个VB菜单设计 界面和功能都不错
💻 FRM
字号:
VERSION 5.00
Object = "{75D4F148-8785-11D3-93AD-0000832EF44D}#3.2#0"; "FAST2003.ocx"
Begin VB.Form frmServices 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "NT Services (only available in Windows NT)"
   ClientHeight    =   5010
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8700
   Icon            =   "Services.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5010
   ScaleWidth      =   8700
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin FLWSystem.FWServices objServices 
      Left            =   4500
      Top             =   90
      _ExtentX        =   820
      _ExtentY        =   820
   End
   Begin VB.CommandButton cmdRefresh 
      Caption         =   "Refresh"
      Default         =   -1  'True
      Height          =   345
      Left            =   2970
      TabIndex        =   4
      Top             =   120
      Width           =   945
   End
   Begin VB.TextBox txtMachine 
      Height          =   315
      Left            =   900
      TabIndex        =   3
      Top             =   120
      Width           =   1935
   End
   Begin VB.TextBox txtService 
      BackColor       =   &H8000000F&
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   4350
      Left            =   2670
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   1
      Top             =   600
      Width           =   5985
   End
   Begin VB.ListBox lstServices 
      Height          =   4350
      Left            =   60
      TabIndex        =   0
      Top             =   600
      Width           =   2535
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Machine"
      Height          =   195
      Left            =   120
      TabIndex        =   2
      Top             =   180
      Width           =   615
   End
End
Attribute VB_Name = "frmServices"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub cmdRefresh_Click()
  objServices.Machine = txtMachine
  Call objServices.Refresh
  Call RefreshData
End Sub

Private Sub Form_Load()
  cmdRefresh.Value = True
End Sub

Private Sub RefreshData()
  Dim objService As FLWSystem.IFWService
  
  Call lstServices.Clear
  txtService = ""
  For Each objService In objServices.Services
    Call lstServices.AddItem(objService.DisplayName)
  Next
  If objServices.Services.Count > 0 Then
    lstServices.ListIndex = 0
  Else
    Call MsgBox("Can't obtain the list of services", vbCritical)
  End If
End Sub

Private Sub lstServices_Click()
  Dim strStatus  As String
  Dim objService As IFWService
  
  Set objService = objServices.Services(lstServices.ListIndex + 1)
  
  With objService
    Select Case .CurrentState
      Case FLWSystem.flwServiceStopped
        strStatus = "Stopped"
      Case FLWSystem.flwServiceStartPending
        strStatus = "Start pending"
      Case FLWSystem.flwServiceStopPending
        strStatus = "Stop pending"
      Case FLWSystem.flwServiceRunning
        strStatus = "Running"
      Case FLWSystem.flwServiceContinuePending
        strStatus = "Continue pending"
      Case FLWSystem.flwPausePending
        strStatus = "Pending"
      Case FLWSystem.flwPaused
        strStatus = "Paused"
    End Select
  
    txtService = "Name                   : " & .ServiceName & vbCrLf & _
                 "Display Name           : " & .DisplayName & vbCrLf & _
                 "Type                   : " & IIf(.ServiceType = flwServiceDriver, "Driver Service", "Win32 Service") & vbCrLf & _
                 "State                  : " & strStatus & vbCrLf & _
                 "W32 Exit code          : " & .Win32ExitCode & vbCrLf & _
                 "Exit code              : " & .ServiceSpecificExitCode & vbCrLf & _
                 "Check point            : " & .CheckPoint & vbCrLf & _
                 "Wait hint              : " & .WaitHint & vbCrLf & _
                 "Accept pause           : " & .AcceptPauseContinue & vbCrLf & _
                 "Accept stop            : " & .AcceptStop & vbCrLf & _
                 "Accept shutdown        : " & .AcceptShutdown & vbCrLf & _
                 "Interacts with desktop : " & IIf(.InteractsWithDesktop, "Yes", "No") & vbCrLf & _
                 "Own process            : " & IIf(.OwnProcess, "Yes", "No") & vbCrLf & _
                 "Shared process         : " & IIf(.ShareProcess, "Yes", "No") & vbCrLf & _
                 "Device driver          : " & IIf(.DeviceDriver, "Yes", "No") & vbCrLf & _
                 "FileSystem driver      : " & IIf(.FileSystemDriver, "Yes", "No")
  End With
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -