📄 frmsend.frm
字号:
ForeColor = &H00008000&
Height = 210
Index = 0
Left = 300
TabIndex = 13
Top = 450
Width = 2100
End
End
End
Attribute VB_Name = "frmSend"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmbMessage_Change()
If cmbMessage.Text = "" Then
cmdSend.Enabled = False
Else
cmdSend.Enabled = True
End If
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdSend_Click()
' 执行代码
If optAll.Value = True Then '所有终端
SM_TEXT = SM_All & "MESAGE" & cmbMessage.Text
Else '选定终端
Dim NS As String
NS = lvSendMessage.SelectedItem.SubItems(1)
NS = left$(NS, 2) '最大机器99台
SM_TEXT = NS & "MESAGE" & cmbMessage.Text
End If
' 发送命令
frmServer.cmdSendData.Value = True
' 如果显示对话框
If chkComplete.Value = vbChecked Then '通知时
If optAll.Value = True Then
MsgBox vbCrLf & "消息:已经成功发送到 [ 所 有 机 器 ] ! " & vbCrLf & vbCrLf & _
" " & Trim(cmbMessage.Text) & vbCrLf & vbCrLf & _
"::::::::::::::::::::::::::::::::::::::::::::::::: " & vbCrLf & _
"", vbInformation, "::::::::::::::::"
Else
MsgBox vbCrLf & "消息: 已经成功发送到 [ " & NS & "号机 ] !" & vbCrLf & vbCrLf & _
" " & Trim(cmbMessage.Text) & vbCrLf & vbCrLf & _
"::::::::::::::::::::::::::::::::::::::::::::::::: " & vbCrLf & _
"", vbInformation, "::::::::::::::::"
End If
End If
End Sub
Private Sub Command1_Click()
' 执行代码
If optAll.Value = True Then '所有终端
SM_TEXT = SM_All & "REBOOT"
Else '选定终端
Dim NS As String
NS = lvSendMessage.SelectedItem.SubItems(1)
NS = left$(NS, 2) '最大机器99台
SM_TEXT = NS & "REBOOT"
End If
' 发送命令
frmServer.cmdSendData.Value = True
' 如果显示对话框
If chkComplete.Value = vbChecked Then '通知时
If optAll.Value = True Then
MsgBox vbCrLf & "重新启动指令:已经成功发送到 [ 所 有 机 器 ] ! " & vbCrLf & vbCrLf & _
"::::::::::::::::::::::::::::::::::::::::::::::::: " & vbCrLf & _
"", vbInformation, "::::::::::::::::"
Else
MsgBox vbCrLf & "重新启动指令: 已经成功发送到 [ " & NS & "号机 ] !" & vbCrLf & vbCrLf & _
"::::::::::::::::::::::::::::::::::::::::::::::::: " & vbCrLf & _
"", vbInformation, "::::::::::::::::"
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
' 执行代码
If optAll.Value = True Then '所有终端
SM_TEXT = SM_All & "SHUTDN"
Else '选定终端
Dim NS As String
NS = lvSendMessage.SelectedItem.SubItems(1)
NS = left$(NS, 2) '最大机器99台
SM_TEXT = NS & "SHUTDN"
End If
' 发送命令
frmServer.cmdSendData.Value = True
' 如果显示对话框
If chkComplete.Value = vbChecked Then '通知时
If optAll.Value = True Then
MsgBox vbCrLf & "关闭计算机指令:已经成功发送到 [ 所 有 机 器 ] ! " & vbCrLf & vbCrLf & _
"::::::::::::::::::::::::::::::::::::::::::::::::: " & vbCrLf & _
"", vbInformation, "::::::::::::::::"
Else
MsgBox vbCrLf & "关闭计算机指令: 已经成功发送到 [ " & NS & "号机 ] !" & vbCrLf & vbCrLf & _
"::::::::::::::::::::::::::::::::::::::::::::::::: " & vbCrLf & _
"", vbInformation, "::::::::::::::::"
End If
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 27 Then
Unload Me
End If
End Sub
Private Sub Form_Load()
FS = True
Dim L As Long, T As Long
L = Val(GetSetting(App.EXEName, "Option", "Send_L", 2000))
T = Val(GetSetting(App.EXEName, "Option", "Send_T", 2000))
Me.left = L
Me.tOp = T
Me.Caption = sJH & " 终端控制室 : 现在是 [ " & Format(Date, "yyyy/mm/dd") & " " & Time & " ] "
chkComplete.Value = Val(GetSetting(App.EXEName, "Option", "CompleteNotify", 0))
Screen.MousePointer = 11
' 初始化数据
' InitListView True '仅显示计费的终端
InitListView False '显示所有机
' 装载配置项的消息条
' 设定系统路径
Dim sFileBuffer As String * 250, retVal As Long, sSystemInI As String
retVal = GetSystemDirectory(sFileBuffer, 251)
If retVal = 0 Then
sSystemInI = "C:\Windows\System\Message.InI"
Else
sSystemInI = left(sFileBuffer, InStr(1, sFileBuffer, Chr(0), vbBinaryCompare) - 1)
sSystemInI = sSystemInI & "\Message.InI"
End If
On Error GoTo 1000 '第一次运行,文件不存在时
Dim sTemp As String, lFile As Long
lFile = FreeFile
Open sSystemInI For Input As #lFile
Do While Not EOF(lFile)
Input #lFile, sTemp
cmbMessage.AddItem sTemp
Loop
Close lFile
GoTo 1010
1000 '
Close lFile
Open sSystemInI For Output As 1
Print #lFile, " 现 在 开 始 计 费 ! "
Print #lFile, " 您 的 费 用 已 经 到 了 ! "
Close lFile
cmbMessage.AddItem " 现 在 开 始 计 费 ! "
cmbMessage.AddItem " 您 的 费 用 已 经 到 了 ! "
1010 '
On Error GoTo 0
If cmbMessage.ListCount > 0 Then
cmbMessage.ListIndex = 0
End If
Screen.MousePointer = 0
End Sub
Private Sub InitListView(OnlyDisplay As Boolean)
Dim x As Integer, Item As ListItems, lstItem As ListItem
Set Item = frmServer.lvComputer.ListItems
Set lvSendMessage.SmallIcons = ImageList1 '初始化
For x = 1 To Item.Count
If OnlyDisplay = True Then
If Item(x).Text = "计费" Then '添加仅计费的列表
Set lstItem = lvSendMessage.ListItems.Add(, , Item(x).Text)
lstItem.SmallIcon = ImageList1.ListImages(2).Key
lstItem.SubItems(1) = Item(x).SubItems(1)
' 选择
If Item(x).Selected = True Then
lstItem.Selected = True
End If
End If
Else
Set lstItem = lvSendMessage.ListItems.Add(, , Item(x).Text)
If Item(x).Text = "空闲" Then
lstItem.SmallIcon = ImageList1.ListImages(1).Key
Else
lstItem.SmallIcon = ImageList1.ListImages(2).Key
End If
lstItem.SubItems(1) = Item(x).SubItems(1)
' 选择
If Item(x).Selected = True Then
lstItem.Selected = True
End If
End If
Next
Set Item = Nothing
Set lstItem = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
FS = False
SaveSetting App.EXEName, "Option", "Send_L", Me.left
SaveSetting App.EXEName, "Option", "Send_T", Me.tOp
SaveSetting App.EXEName, "Option", "CompleteNotify", chkComplete.Value
End Sub
Private Sub optAll_Click()
If picSendMessage.Visible = True Then
cmbMessage.SetFocus
ElseIf picRestart.Visible = True Then
Command1.SetFocus
Else
Command3.SetFocus
End If
End Sub
Private Sub optSelected_Click()
If picSendMessage.Visible = True Then
cmbMessage.SetFocus
ElseIf picRestart.Visible = True Then
Command1.SetFocus
Else
Command3.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -