📄 routines.bas
字号:
mstrParameters = "MaxWidth: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Minimum Resolution.
'----------------------------------------------------------
If gblnGetMinResolutionSupported = True Then
mstrParameters = "MinResolution=" & glngMinResolution
Else
mstrParameters = "MinResolution: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Maximum Resolution.
'----------------------------------------------------------
If gblnGetMaxResolutionSupported = True Then
mstrParameters = "MaxResolution=" & glngMaxResolution
Else
mstrParameters = "MaxResolution: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Resolution Step.
'----------------------------------------------------------
If gblnGetResolutionStepSupported = True Then
If gblnResolutionStepArray = True Then
mstrParameters = "ResolutionStep=Array"
Else
mstrParameters = "ResolutionStep=" & glngResolutionStep
End If
Else
mstrParameters = "ResolutionStep: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Minimum Brightness.
'----------------------------------------------------------
If gblnGetMinBrightnessSupported = True Then
mstrParameters = "MinBrightness=" & glngMinBrightness
Else
mstrParameters = "MinBrightness: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Maximum Brightness.
'----------------------------------------------------------
If gblnGetMaxBrightnessSupported = True Then
mstrParameters = "MaxBrightness=" & glngMaxBrightness
Else
mstrParameters = "MaxBrightness: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Brightess Step.
'----------------------------------------------------------
If gblnGetBrightnessStepSupported = True Then
If gblnBrightnessStepArray = True Then
mstrParameters = "BrightnessStep=Array"
Else
mstrParameters = "BrightnessStep=" & glngBrightnessStep
End If
Else
mstrParameters = "BrightnessStep: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log AutoBrightness.
'----------------------------------------------------------
If gblnGetAutoBrightnessSupported = True Then
mstrParameters = "AutoBrightness=" & gstrAutoBrightness
Else
mstrParameters = "AutoBrightness: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Minimum Contrast.
'----------------------------------------------------------
If gblnGetMinContrastSupported = True Then
mstrParameters = "MinContrast=" & glngMinContrast
Else
mstrParameters = "MinContrast: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Maximum Contrast.
'----------------------------------------------------------
If gblnGetMaxContrastSupported = True Then
mstrParameters = "MaxContrast=" & glngMaxContrast
Else
mstrParameters = "MaxContrast: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Contrast Step.
'----------------------------------------------------------
If gblnGetContrastStepSupported = True Then
If gblnContrastStepArray = True Then
mstrParameters = "ContrastStep=Array"
Else
mstrParameters = "ContrastStep=" & glngContrastStep
End If
Else
mstrParameters = "ContrastStep: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log AutoContrast.
'----------------------------------------------------------
If gblnGetAutoContrastSupported = True Then
mstrParameters = "AutoContrast=" & gstrAutoContrast
Else
mstrParameters = "AutoContrast: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log ADF Available.
'----------------------------------------------------------
If gblnGetADFAvailableSupported = True Then
mstrParameters = "ADFAvailable=" & gstrADFAvailable
Else
mstrParameters = "ADFAvailable: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
'----------------------------------------------------------
' Log Max Height ADF.
'----------------------------------------------------------
If gblnGetMaxHeightADFSupported = True Then
mstrParameters = "MaxHeightADF=" & gstrADFAvailable
Else
mstrParameters = "MaxHeightADF: Unsupported"
End If
Call frmEventLog.GenerateLogEvent(mstrPMEType, mstrEventName, mstrParameters)
Exit Sub
ScanError:
If frmMain.ImgScan1.StatusCode <> 0 Then
MsgBox Err.Description & " (ImgScan error " & _
Hex(frmMain.ImgScan1.StatusCode) & ")", vbCritical
End If
End Sub
Public Sub GetSaveUserPreferences(strGetSave As String)
'**************************************************************
' PUBLIC SUB GetSaveUserPreferences: This uses GetSetting
' to get user preferences from the Windows Registry. It also
' uses SaveSetting to save user preferences to the Windows
' Registry.
'**************************************************************
'----------------------------------------------------------
' Save: If saving the preferences, save them and then
' exit the subroutine.
'----------------------------------------------------------
If strGetSave = "Save" Then
SaveSetting APP_NAME, SCAN_PREF_KEY, "Scan Settings", gintScanSettings
SaveSetting APP_NAME, SCAN_PREF_KEY, "Document Type", gintDocumentTypeIndex
SaveSetting APP_NAME, SCAN_PREF_KEY, "Use ADF", gblnUseADF
SaveSetting APP_NAME, SCAN_PREF_KEY, "Scan To Directory", gstrScanToDirectory
SaveSetting APP_NAME, SCAN_PREF_KEY, "Color", gintColorIndex
SaveSetting APP_NAME, SCAN_PREF_KEY, "Horizontal DPI", gintHorizontalDPI
SaveSetting APP_NAME, SCAN_PREF_KEY, "Vertical DPI", gintVerticalDPI
SaveSetting APP_NAME, SCAN_PREF_KEY, "Paper Size", gintPaperSizeIndex
SaveSetting APP_NAME, SCAN_PREF_KEY, "Paper Width", gdblPaperWidth
SaveSetting APP_NAME, SCAN_PREF_KEY, "Paper Height", gdblPaperHeight
If frmMain.WindowState <> vbMinimized Then
SaveSetting APP_NAME, WINDOW_POS_KEY, "Left", frmMain.Left
SaveSetting APP_NAME, WINDOW_POS_KEY, "Top", frmMain.Top
SaveSetting APP_NAME, WINDOW_POS_KEY, "Width", frmMain.Width
SaveSetting APP_NAME, WINDOW_POS_KEY, "Height", frmMain.Height
End If
Exit Sub
End If
'----------------------------------------------------------
' Get: Get the "Scan Settings" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Scan Settings") = Empty Then
gintScanSettings = 1
Else
gintScanSettings = GetSetting(APP_NAME, SCAN_PREF_KEY, "Scan Settings")
End If
'----------------------------------------------------------
' Get: Get the "Document Type" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Document Type") = Empty Then
gintDocumentTypeIndex = 0
Else
gintDocumentTypeIndex = GetSetting(APP_NAME, SCAN_PREF_KEY, "Document Type")
End If
'----------------------------------------------------------
' Get: Get the "Use ADF" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Use ADF") = Empty Then
gblnUseADF = True
Else
gblnUseADF = GetSetting(APP_NAME, SCAN_PREF_KEY, "Use ADF")
End If
'----------------------------------------------------------
' Get: Get the "Scan To Directory" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Scan To Directory") = Empty Then
gstrScanToDirectory = gstrWindowsDirectory
Else
gstrScanToDirectory = GetSetting(APP_NAME, SCAN_PREF_KEY, "Scan To Directory")
End If
'----------------------------------------------------------
' Get: Get the "Color" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Color") = Empty Then
gintColorIndex = 0
Else
gintColorIndex = GetSetting(APP_NAME, SCAN_PREF_KEY, "Color")
End If
'----------------------------------------------------------
' Get: Get the "Horizontal DPI" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Horizontal DPI") = Empty Then
gintHorizontalDPI = 200
Else
gintHorizontalDPI = GetSetting(APP_NAME, SCAN_PREF_KEY, "Horizontal DPI")
End If
'----------------------------------------------------------
' Get: Get the "Vertical DPI" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Vertical DPI") = Empty Then
gintVerticalDPI = 200
Else
gintVerticalDPI = GetSetting(APP_NAME, SCAN_PREF_KEY, "Vertical DPI")
End If
'----------------------------------------------------------
' Get: Get the "Page Size" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Paper Size") = Empty Then
gintPaperSizeIndex = 0
Else
gintPaperSizeIndex = GetSetting(APP_NAME, SCAN_PREF_KEY, "Paper Size")
End If
'----------------------------------------------------------
' Get: Get the "Page Width" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Paper Width") = Empty Then
gdblPaperWidth = 8.5
Else
gdblPaperWidth = GetSetting(APP_NAME, SCAN_PREF_KEY, "Paper Width")
End If
'----------------------------------------------------------
' Get: Get the "Page Height" preference.
'----------------------------------------------------------
If GetSetting(APP_NAME, SCAN_PREF_KEY, "Paper Height") = Empty Then
gdblPaperHeight = 8.5
Else
gdblPaperHeight = GetSetting(APP_NAME, SCAN_PREF_KEY, "Paper Height")
End If
'----------------------------------------------------------
' Get: If no coordinates were saved, center the screen;
' otherwise, get the last window position.
'----------------------------------------------------------
If GetSetting(APP_NAME, WINDOW_POS_KEY, "Left") = Empty Then
frmMain.Move (Screen.Width - frmMain.Width) / 2, _
(Screen.Height - frmMain.Height) / 2
Else
frmMain.Left = GetSetting(APP_NAME, WINDOW_POS_KEY, "Left")
frmMain.Top = GetSetting(APP_NAME, WINDOW_POS_KEY, "Top")
frmMain.Width = GetSetting(APP_NAME, WINDOW_POS_KEY, "Width")
frmMain.Height = GetSetting(APP_NAME, WINDOW_POS_KEY, "Height")
End If
End Sub
Public Sub RefreshStatusForm(strLabel As String, strFile As String)
'**************************************************************
' PUBLIC SUB RefreshStatusForm: Refreshes the Status Form
' in order to display the updated label.
'**************************************************************
frmStatus.lblTitle = strLabel
frmStatus.lblFile = strFile
frmStatus.Refresh
End Sub
Public Function SplitPath(strFullPathFileName As String, strPathOrFile) As String
'**************************************************************
' PUBLIC FUNCTION SplitPath: This splits a fully qualified
' path name into its two components: the path name or the
' file name. Which is returned depends upon the value of
' the switch strPathOrFile ("Path" or "File").
'**************************************************************
'** Integers
Dim intBackslashPosition As Integer
Dim intFullPathFileNameLength As Integer
Dim intFileNameLength As Integer
Dim intPathNameLength As Integer
'** Strings
Dim strWorkingString As String
Dim strFileName As String
Dim strPathName As String
'----------------------------------------------------------
' Look for a backslash. If you find one, strip off
' everything to the left of the backslash. Do this until
' there are no more backslashes.
'----------------------------------------------------------
strWorkingString = strFullPathFileName
Do
intBackslashPosition = InStr(1, strWorkingString, "\")
If intBackslashPosition > 0 Then
strWorkingString = Mid(strWorkingString, intBackslashPosition + 1)
End If
Loop Until intBackslashPosition = 0
strFileName = Trim(strWorkingString)
'----------------------------------------------------------
' Subtract the length of resulting file name from the
' entire path to get just the path name.
'----------------------------------------------------------
intFullPathFileNameLength = Len(strFullPathFileName)
intFileNameLength = Len(strFileName)
intPathNameLength = intFullPathFileNameLength - (intFileNameLength + 1)
strPathName = Mid(strFullPathFileName, 1, intPathNameLength)
'----------------------------------------------------------
' Depending upon the value of the strPathOrFile switch,
' pass back the path name or the file name.
'----------------------------------------------------------
If strPathOrFile = "Path" Then
SplitPath = strPathName
Else
SplitPath = strFileName
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -