📄 form_sel.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Form_Sel
Caption = "打开方式设置"
ClientHeight = 6855
ClientLeft = 1230
ClientTop = 1695
ClientWidth = 9480
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6855
ScaleWidth = 9480
WhatsThisHelp = -1 'True
Begin MSComDlg.CommonDialog FileDialog
Left = 4320
Top = 120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
Filter = ".exe"
End
Begin MSFlexGridLib.MSFlexGrid Grid_Brow
Height = 3375
Left = 360
TabIndex = 7
Top = 2880
Width = 8655
_ExtentX = 15266
_ExtentY = 5953
_Version = 393216
AllowUserResizing= 1
End
Begin VB.Frame Frame1
Caption = "操作"
Height = 2175
Left = 360
TabIndex = 0
Top = 480
Width = 8655
Begin VB.TextBox Text_Des
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 405
Left = 1680
TabIndex = 12
Top = 360
Width = 1575
End
Begin VB.CommandButton Com_Ok
Caption = "添加"
Height = 375
Left = 6000
TabIndex = 3
Top = 1560
Width = 1215
End
Begin VB.CommandButton Com_Cancel
Caption = "退出"
Height = 375
Left = 7200
TabIndex = 4
Top = 1560
Width = 1215
End
Begin VB.CommandButton Com_Search
Caption = "浏览.."
Height = 375
Left = 4800
TabIndex = 2
Top = 1560
Width = 1215
End
Begin VB.TextBox Text_Extend
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 6240
TabIndex = 1
Text = "."
Top = 360
Width = 1095
End
Begin VB.TextBox Text_Exe
Enabled = 0 'False
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 1680
TabIndex = 11
Top = 960
Width = 6615
End
Begin VB.Label Label2
Caption = "(如 文本文件)"
Height = 255
Index = 0
Left = 3360
TabIndex = 10
Top = 480
Width = 1335
End
Begin VB.Label Label1
Caption = "打开方式描述"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 255
Index = 2
Left = 120
TabIndex = 9
Top = 360
Width = 1575
End
Begin VB.Label Label2
Caption = "(如 .Txt)"
Height = 255
Index = 1
Left = 7560
TabIndex = 8
Top = 480
Width = 735
End
Begin VB.Label Label1
Caption = "文件扩展名 "
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 255
Index = 1
Left = 4680
TabIndex = 6
Top = 360
Width = 1335
End
Begin VB.Label Label1
Caption = "可执行文件"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 255
Index = 0
Left = 360
TabIndex = 5
Top = 960
Width = 1335
End
End
End
Attribute VB_Name = "Form_Sel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Com_Cancel_Click()
Form_Manage.Show
Unload Me
End Sub
Private Sub Com_OK_Click()
Dim objRs As New ADODB.Recordset
Dim mErr As String
Dim strFormat As String
If Len(Trim(Text_Des.Text)) = 0 Then
MsgBox "请输入打开方式描述"
Exit Sub
End If
If Left(Trim(Text_Extend.Text), 1) <> "." Or Len(Trim(Text_Extend.Text)) <= 1 Then
MsgBox "扩展名不符合规则"
Exit Sub
End If
If Len(Trim(Text_Exe.Text)) = 0 Then
MsgBox "请选择可执行文件"
Exit Sub
End If
If UCase(Right(Trim(Text_Exe.Text), 3)) <> "EXE" Then
MsgBox "此文件非可执行文件"
Exit Sub
End If
On Error GoTo Err
'添加应用程序字典库
objRs.Open "SysExe", CModule.objCon, adOpenStatic, adLockOptimistic
objRs.AddNew
objRs("ExeDes") = Trim(Text_Des.Text)
objRs("ExeName") = Trim(Text_Exe.Text)
objRs("ExeExtend") = Trim(Text_Extend.Text)
strFormat = Trim(Text_Exe.Text) '提取Exe文件的路径
strFormat = Mid(strFormat, InStrRev(strFormat, "\") + 1, _
InStrRev(strFormat, ".") - InStrRev(strFormat, "\") - 1) '提取Exe文件名
objRs("FormatName") = "\\" & CModule.objIp & "\" & CModule.objPath & "Format\" & _
strFormat & Trim(Text_Extend.Text) '将扩展名添加到Exe文件名之后
objRs.Update
MsgBox ("请在打开的" & strFormat & " 应用程序中保存新文件,文件名:" & Trim(objRs("FormatName")))
'ChDir "\\" & CModule.objIp & "\" & CModule.objPath & "Format"
If CModule.OpenFile(Trim(Text_Exe.Text), mErr) = False Then
MsgBox mErr
End If
CModule.CloseRs objRs
'刷新页面
Form_Load
Exit Sub
Err:
Select Case Err.Number
Case 90
MsgBox mErr
Case Else
MsgBox " 系统出错!错误描述:" & Err.Description
objRs.CancelUpdate
CModule.CloseRs objRs
End Select
End Sub
Private Sub Com_Search_Click()
FileDialog.Filter = "*.exe|*.exe"
FileDialog.FilterIndex = 1
FileDialog.ShowOpen
Text_Exe.Text = FileDialog.FileName
End Sub
Private Sub Form_Load()
Dim objRs As New ADODB.Recordset
Dim strSql As String
'数据库连接
If CModule.IsConnect() = False Then
MsgBox "数据库连接失败"
Exit Sub
End If
strSql = "select * from SysExe"
objRs.Open strSql, CModule.objCon, adOpenStatic, adLockOptimistic, adCmdText
If GridBrow(objRs) = False Then
MsgBox "数据显示失败"
Exit Sub
End If
End Sub
Private Function GridBrow(ByVal objRes As Object) As Boolean
Dim IntCount As Integer
On Error GoTo Err
Grid_Brow.Rows = objRes.RecordCount + 1
Grid_Brow.Cols = 4
Grid_Brow.CellAlignment = flexAlignLeftCenter
Grid_Brow.Row = 0
Grid_Brow.Col = 0
Grid_Brow.Text = "打开方式描述"
Grid_Brow.Col = 1
Grid_Brow.Text = "可执行文件名称"
Grid_Brow.Col = 2
Grid_Brow.Text = "模板文件名"
Grid_Brow.Col = 3
Grid_Brow.Text = "文件扩展名"
For IntCount = 0 To 3
Grid_Brow.ColWidth(IntCount) = Grid_Brow.Width / 4
Grid_Brow.Row = 0
Grid_Brow.Col = IntCount
Grid_Brow.CellForeColor = &H8000000D
Grid_Brow.CellFontBold = True
Grid_Brow.CellFontSize = 12
Next
IntCount = 1
While Not objRes.EOF
Grid_Brow.Row = IntCount
Grid_Brow.Col = 0
Grid_Brow.Text = objRes("ExeDes")
Grid_Brow.Col = 1
Grid_Brow.Text = objRes("ExeName")
Grid_Brow.Col = 2
Grid_Brow.Text = objRes("FormatName")
Grid_Brow.Col = 3
Grid_Brow.Text = objRes("ExeExtend")
IntCount = IntCount + 1
objRes.MoveNext
Wend
CModule.CloseRs objRes
GridBrow = True
Exit Function
Err:
CModule.CloseRs objRes
GridBrow = False
End Function
Private Sub Grid_Brow_Click()
Grid_Brow.ToolTipText = Grid_Brow.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -