📄 loader.frm
字号:
VERSION 2.00
Begin Form frmLoader
BorderStyle = 3 'Fixed Double
ClientHeight = 1740
ClientLeft = 765
ClientTop = 4020
ClientWidth = 5010
ControlBox = 0 'False
Height = 2160
Left = 705
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1740
ScaleWidth = 5010
Top = 3660
Width = 5130
Begin SSPanel panPannel
BevelWidth = 3
BorderWidth = 1
Height = 1740
Left = -15
Outline = -1 'True
TabIndex = 1
Top = 0
Width = 5040
Begin SSPanel panFloodBar
BevelWidth = 3
BorderWidth = 1
Height = 420
Left = 135
Outline = -1 'True
TabIndex = 3
Top = 690
Width = 4710
End
Begin Label labLabel
BackStyle = 0 'Transparent
Caption = "Loading Module :"
Height = 330
Index = 2
Left = 195
TabIndex = 5
Top = 1230
Width = 1605
End
Begin Label labModule
BackStyle = 0 'Transparent
Height = 300
Left = 1875
TabIndex = 4
Top = 1215
Width = 2970
End
Begin Label labLabel
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Application Loader"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 13.5
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 435
Index = 0
Left = 150
TabIndex = 2
Top = 225
Width = 4620
End
Begin Label labLabel
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Application Loader"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 13.5
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00FFFFFF&
Height = 435
Index = 1
Left = 240
TabIndex = 0
Top = 240
Width = 4530
End
End
End
Option Explicit
' ===========================================================================================
' Local String Declarations
' ===========================================================================================
Dim sLoaderList As String ' String Declaring the path and list of files to load into memory
Dim s3270Path As String
Dim s3270WorkingDirectory As String
' ===========================================================================================
' Local Integer Declarations
' ===========================================================================================
Dim iModuleListFileHandler As Integer ' Integer declaring the file handle for the Module list
Dim lCurrentPercent As Long ' Current Percentage value for panel
Dim lMaxPercent As Long ' Maximum percentage value for panel
' ===========================================================================================
' Local Constant Declarations
' ===========================================================================================
Const APPLICATION_INIFILE = "\LOADER.INI" ' Name of the applications INI file
Const NO_3270SESSION = "No Sesstion"
Function bLoadMemory (sFileName As String) As Integer
On Error GoTo bLoadMemoryError
Dim tParameterBlock As PARAMETERBLOCK
'Dim iShowWindow(2) As Integer
'iShowWindow(1) = 2
'iShowWindow(2) = SW_SHOWNORMAL
' tParameterBlock.wEnvSeg = 0
' tParameterBlock.lpCmdLine = ("")
' tParameterBlock.lpCmdShow=
' tParameterBlock.dwReserved = 0
If LoadModule(sFileName, tParameterBlock) < 32 Then
MsgBox ("Failed to Load")
bLoadMemory = False
Exit Function
End If
bLoadMemory = True
Exit Function
bLoadMemoryError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "bLoadMemory")
bLoadMemory = False
Exit Function
Resume 0
End Function
Sub ExitApplication ()
On Error GoTo ExitApplicationError
screen.MousePointer = DEFAULT
End
Exit Sub
ExitApplicationError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "ExitApplicationError")
Exit Sub
Resume 0
End Sub
Sub Form_Load ()
On Error GoTo Form_LoadError
screen.MousePointer = HOURGLASS
Call CentreMe(Me)
Me.Show
Call SetupGlobalVariables
Call SetupApplicationVariables
Call Load3270Session
Call LoadModuleList
Call ExitApplication
screen.MousePointer = DEFAULT
Exit Sub
Form_LoadError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "Form_Load")
Exit Sub
Resume 0
End Sub
Sub IncreasePercentage ()
On Error GoTo IncreasePercentageError
lCurrentPercent = lCurrentPercent + 1
If Int((lCurrentPercent / lMaxPercent) * 100) <> panFloodBar.FloodPercent Then
panFloodBar.FloodPercent = Int((lCurrentPercent / lMaxPercent) * 100)
DoEvents
End If
Exit Sub
IncreasePercentageError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "IncreasePercentage")
Exit Sub
Resume 0
End Sub
Function lModuleCount () As Long
On Error GoTo lModuleCountError
Dim sModule As String
Dim lModuleTempCount As Long
lModuleCount = 0
While Not EOF(iModuleListFileHandler)
Line Input #iModuleListFileHandler, sModule
lModuleTempCount = lModuleTempCount + 1
DoEvents
Wend
lModuleCount = lModuleTempCount
Exit Function
lModuleCountError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "lModuleCount")
Exit Function
Resume 0
End Function
Sub Load3270Session ()
On Error GoTo Load3270SessionError
Dim iRetValue As Integer
Dim sCurrentPath As String
If s3270Path = NO_3270SESSION Then
Exit Sub
End If
sCurrentPath = app.Path
ChDir s3270WorkingDirectory
iRetValue = Shell(s3270Path, 1)
' While GetModuleUsage(iRetValue) > 0
' DoEvents
' Wend
ChDir sCurrentPath
Exit Sub
Load3270SessionError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "Load3270Session")
Exit Sub
Resume 0
End Sub
Sub LoadModuleList ()
On Error GoTo LoadModuleListError
Dim sModule As String
Call OpenModuleFile
Call SetPanelPercentage
Close iModuleListFileHandler
Call OpenModuleFile
While Not EOF(iModuleListFileHandler)
Line Input #iModuleListFileHandler, sModule
labModule.Caption = sModule
If Not bLoadMemory(Trim$(sModule)) Then MsgBox "Fail"
Call IncreasePercentage
Wend
Close iModuleListFileHandler
Exit Sub
LoadModuleListError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "LoadModuleList")
Exit Sub
Resume 0
End Sub
Sub OpenModuleFile ()
On Error GoTo OpenModuleFileError
iModuleListFileHandler = FreeFile
Open sLoaderList For Input As #iModuleListFileHandler
Exit Sub
OpenModuleFileError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "OpenModuleFile")
Exit Sub
Resume 0
End Sub
Sub SetPanelPercentage ()
On Error GoTo SetPanelPercentageError
lCurrentPercent = 0
lMaxPercent = lModuleCount()
panFloodBar.FloodPercent = 0
panFloodBar.FloodType = 1
Exit Sub
SetPanelPercentageError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "SetPanelPercentage")
Exit Sub
Resume 0
End Sub
Sub SetupApplicationVariables ()
On Error GoTo SetupApplicationVariablesError
sLoaderList = GetINIStringValue("ModuleList", "FileName", app.Path & "\LOADER.TXT", app.Path & APPLICATION_INIFILE)
s3270Path = GetINIStringValue("3270", "AppPath", NO_3270SESSION, app.Path & APPLICATION_INIFILE)
s3270WorkingDirectory = GetINIStringValue("3270", "AppWorkingDirectory", NO_3270SESSION, app.Path & APPLICATION_INIFILE)
Exit Sub
SetupApplicationVariablesError:
Call ErrorHandler(Err, Erl, "LOADER.FRM", "SetupApplicationVariables")
Exit Sub
Resume 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -