📄 modworkflow.bas
字号:
Attribute VB_Name = "modWorkFlow"
Public Sub Main()
Install "SSubTmr6.dll"
'Install "cmax20.ocx"
'Install "prjChameleon.ocx"
'Install "cPopMenu.ocx"
'Install "Font.ocx"
'Install "Tree.ocx"
'Install "ColorPicker.ocx"
CommandString = Command
DoEvents
frmSplash.Show
End Sub
Public Function NewBlankPage() As Boolean
CIndex = FindFreeCreator
EIndex = FindFreeEditor
If CIndex = 0 Then
CIndex = 1
ReDim Creator(1 To 1)
ReDim CStatus(1 To 1)
End If
If EIndex = 0 Then
EIndex = 1
ReDim Editor(1 To 1)
End If
MfrmProgram.FileTab.Tabs.Add , "key" & CIndex, , 1
'Yes, it's CIndex. This can link the Editor & Creator
Editor(EIndex).Tag = CIndex
With Creator(CIndex)
.Show
.Tag = CIndex
.DHTML1.DocumentHTML = NewHTML
.Job = "gethtml"
.Caption = "Untitled " & CIndex
End With
With CStatus(CIndex)
.Dirty = False
.HTMLOpened = False
.FileTitle = "Untitled " & CIndex
.OpenFromROM = False
.Saved = False
.TempFilename = App.Path & "\Temp" & CIndex & ".htm"
End With
Creator(CIndex).Ready = "True"
MfrmProgram.FileTab.Tabs("key" & CIndex).Caption = CStatus(CIndex).FileTitle
MfrmProgram.FileTab.Tabs("key" & CIndex).Selected = True
End Function
Public Function OpenFile(Filename As String) As Integer
On Error GoTo ErrorHandle
'Prepare a set of empty form
CIndex = FindFreeCreator
EIndex = FindFreeEditor
If CIndex = 0 Then
CIndex = 1
ReDim Creator(1 To 1)
ReDim CStatus(1 To 1)
End If
If EIndex = 0 Then
EIndex = 1
ReDim Editor(1 To 1)
End If
Editor(EIndex).Tag = CIndex
'Normal Open: 0
'Open from ROM: 1
'Open Failed: -1
'If the file is read-only, the return:
'FileAttr mod 2 =1
Creator(CIndex).Tag = CIndex
Dim Attr As VbFileAttribute
Attr = GetAttr(Filename)
If Attr Mod 2 = 1 Then 'Read Only
With CStatus(CIndex)
.OpenFromROM = True
.Dirty = False
.FileTitle = StripPath(Filename)
.HTMLOpened = False
.OriginalFilename = Filename
.Saved = True
End With
With Creator(CIndex)
.DHTML1.LoadDocument Filename
.Caption = StripPath(Filename)
.Job = "gethtml"
.CheckAcc
End With
Creator(CIndex).Show
MfrmProgram.FileTab.Tabs.Add , "key" & CIndex, , 2
MfrmProgram.FileTab.Tabs("key" & CIndex).Caption = StripPath(Filename) & " (Read-Only)"
MfrmProgram.FileTab.Tabs("key" & CIndex).Selected = True
Creator(CIndex).Ready = "True"
OpenFile = 1
Else 'Normal Opening
With Creator(CIndex)
.DHTML1.LoadDocument Filename
.Caption = StripPath(Filename)
.Job = "gethtml"
.CheckAcc
End With
With CStatus(CIndex)
.TempFilename = Replace$(Filename, ".", "TMP.")
.Dirty = False
.FileTitle = StripPath(Filename)
.HTMLOpened = False
.OpenFromROM = False
.OriginalFilename = Filename
.Saved = True
End With
Creator(CIndex).Show
MfrmProgram.FileTab.Tabs.Add , "key" & CIndex, , 2
MfrmProgram.FileTab.Tabs("key" & CIndex).Caption = StripPath(Filename)
MfrmProgram.FileTab.Tabs("key" & CIndex).Selected = True
Creator(CIndex).Ready = "True"
OpenFile = 0
End If
SaveHistory Filename
Exit Function
ErrorHandle:
MsgErr
Creator(CIndex).Job = "kill"
Unload Creator(CIndex)
Unload Editor(EIndex)
OpenFile = -1
End Function
Public Function OpenTemp(Filename As String) As Long
On Error GoTo ErrorHandle
'Prepare a set of empty form
CIndex = FindFreeCreator
EIndex = FindFreeEditor
If CIndex = 0 Then
CIndex = 1
ReDim Creator(1 To 1)
ReDim CStatus(1 To 1)
End If
If EIndex = 0 Then
EIndex = 1
ReDim Editor(1 To 1)
End If
Editor(EIndex).Tag = CIndex
'Normal Open: 0
'Open Failed: -1
Creator(CIndex).Tag = CIndex
With Creator(CIndex)
.DHTML1.LoadDocument Filename
.Caption = StripPath(Filename)
.Job = "gethtml"
.CheckAcc
End With
With CStatus(CIndex)
.TempFilename = Replace$(Filename, ".", "TMP.")
.Dirty = False
.FileTitle = StripPath(Filename)
.HTMLOpened = False
.OpenFromROM = False
.OriginalFilename = Filename
.Saved = False
End With
Creator(CIndex).Show
MfrmProgram.FileTab.Tabs.Add , "key" & CIndex, , 2
MfrmProgram.FileTab.Tabs("key" & CIndex).Caption = StripPath(Filename) & "(Template)"
MfrmProgram.FileTab.Tabs("key" & CIndex).Selected = True
Creator(CIndex).Ready = "True"
OpenTemp = 0
Exit Function
ErrorHandle:
MsgErr
Creator(CIndex).Job = "kill"
Unload Creator(CIndex)
Unload Editor(EIndex)
OpenTemp = -1
End Function
Public Function SaveFile(Creator As frmMain, ByRef Dialog As CommonDialog, ByRef TheFormStatus As FormStatus, SaveAs As Boolean) As Long
If SaveAs = False Then
Select Case TheFormStatus.Saved
Case False
'Prompt dialog for Filename
WithDialog:
With Dialog
.Filter = "HTML File *.htm|*.htm"
.Flags = cdlOFNOverwritePrompt
On Error GoTo ErrorHandle
.ShowSave
Creator.DHTML1.SaveDocument .Filename
End With
With TheFormStatus
.Saved = True
.Dirty = False
.TempFilename = Replace(Dialog.Filename, ".", "TMP.")
.HTMLString = Creator.DHTML1.DocumentHTML
.OriginalFilename = Dialog.Filename
End With
Creator.Caption = StripPath(Dialog.Filename)
Creator.UpdateTabCaption
Creator.DHTML1.LoadDocument Dialog.Filename
SaveFile = 0
Exit Function
Case True
'Save File immediately without Dialog
WithoutDialog:
With TheFormStatus
On Error GoTo ErrorHandle
Creator.DHTML1.SaveDocument .OriginalFilename
.Saved = True
.Dirty = False
.TempFilename = Replace(Dialog.Filename, ".", "TMP.")
.HTMLString = Creator.DHTML1.DocumentHTML
.OriginalFilename = Dialog.Filename
End With
SaveFile = 0
Exit Function
End Select
Else 'SaveAs =True
GoTo WithDialog
End If
ErrorHandle:
SaveFile = Err.Number
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -