⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modprintsys.bas

📁 排队分诊管理系统源代码!该代码使用VB6开发环境
💻 BAS
字号:
Attribute VB_Name = "modPrintSys"
Option Explicit

Dim m_tagErrInfo                As TYPE_ERRORINFO       ' 错误信息

Private Declare Function GetProfileInt Lib "kernel32" _
    Alias "GetPrivateProfileIntA" (ByVal SecName As String, _
                                   ByVal EntrName As String, _
                                   ByVal DefNum As Integer, _
                                   ByVal FileName As String) As Long

Private Declare Function GetProfileStr Lib "kernel32" _
    Alias "GetPrivateProfileStringA" (ByVal SecName As String, _
                                      ByVal EntrName As String, _
                                      ByVal DefString As String, _
                                      ByVal buff As String, _
                                      ByVal BuffSize As Long, _
                                      ByVal FileName As String) As Long
'DRIVER INFO
Private Const DRIVER_PROFILE_NAME = "driver_list.ini"
Private Const SEC_DRV_INFO = "DRIVER_INFO"
Private Const ENTR_DRV_NUM = "driver_num"
Private Const ENTR_DRV_NAME = "name"
Private Const ENTR_FONT_IDX = "font_index"
Private Const ENTR_FONTS = "font_num"
Private Const ENTR_BARCODE_PRN = "barcode_prn"
Private Const ENTR_PAPER_CUT = "paper_cut"
Private Const ENTR_CUST_DISP = "cust_disp"
Private Const ENTR_PAPER_TYP = "paper_type"
'FONT INFO
Private Const FONT_PROFILE_NAME = "font_list.ini"
Private Const SEC_FONT_INFO = "FONT_INFO"
Private Const ENTR_FONT_NUM = "font_num"
Private Const ENTR_FONT_NAME = "name"
Private Const ENTR_SIZE_NUM = "size_num"
Private Const ENTR_SIZE_1 = "size1"
Private Const ENTR_SIZE_2 = "size2"
Private Const ENTR_FONT_TYPE = "type"

Private Const SIZE_PROFILE_DATA = 255

Public Sub Clear_TMPrinterData()
    On Error GoTo ERROR_EXIT
    
    Erase TMDriver
    intDrvCount = 0
    Erase TMFont
    intPFontCount = 0
    Erase BarcodeFont
    intBFontCount = 0
    Exit Sub
ERROR_EXIT:
    m_tagErrInfo.strErrDate = Format(Now, "yyyy-mm-dd hh:mm:ss")
    m_tagErrInfo.strErrFile = "Clear_TMPrinterData"
    m_tagErrInfo.strErrFunc = "modPrintSys"
    m_tagErrInfo.nErrNum = Err.Number
    m_tagErrInfo.strErrDesc = Error(Err.Number)
    If Err.Number <> 0 Then Err.Clear
    modErrorInfo.WriteErrLog m_tagErrInfo
End Sub

Public Function Init_TMPrinterData() As Boolean
    On Error GoTo ERROR_EXIT
    
    Dim driver_num As Long
    Dim ini_path As String
    Dim i As Long
    Dim wk_sec_name As String
    Dim buff As String * SIZE_PROFILE_DATA
    Dim len_buff, wk_len As Long
    Dim font_num As Long

    'Initialization of a paper source message.
    TMPaper(0) = "Receipt"
    TMPaper(1) = "Slip"
    TMPaper(2) = "Journal"
    TMPaper(3) = "Validation"
    TMPaper(4) = "Label"
    TMPaper(5) = "Receipt/Journal"
    TMPaper(6) = "Endorse"

    'Initialization of a printer driver table.
    ini_path = App.Path & "\" & DRIVER_PROFILE_NAME
    driver_num = GetProfileInt(SEC_DRV_INFO, ENTR_DRV_NUM, 0, ini_path)
    ReDim TMDriver(driver_num)
    
    For i = 0 To driver_num - 1
        wk_sec_name = "DRV_" & Format$(i + 1, "0000")
        len_buff = GetProfileStr(wk_sec_name, ENTR_DRV_NAME, "", buff, SIZE_PROFILE_DATA, ini_path)
        If (len_buff > 0) Then
            TMDriver(i).Name = Left$(buff, len_buff): buff = ""
            TMDriver(i).idx = GetProfileInt(wk_sec_name, ENTR_FONT_IDX, 0, ini_path)
            TMDriver(i).num = GetProfileInt(wk_sec_name, ENTR_FONTS, 0, ini_path)
            TMDriver(i).BFont = GetProfileInt(wk_sec_name, ENTR_BARCODE_PRN, 0, ini_path)
            TMDriver(i).PCut = GetProfileInt(wk_sec_name, ENTR_PAPER_CUT, 0, ini_path)
            '>>> V1.58 DM-D Sample Modify 1999-11-04 >>>
            'TMDriver(i).CDisplay = GetProfileInt(wk_sec_name, ENTR_CUST_DISP, 0, ini_path)
            TMDriver(i).CDisplay = 1
            '<<< V1.58 DM-D Sample Modify 1999-11-04 <<<
            TMDriver(i).Paper = GetProfileInt(wk_sec_name, ENTR_PAPER_TYP, 0, ini_path)

        End If
    Next i
    intDrvCount = driver_num - 1

    'Initialization of a printer font table.
    ini_path = App.Path & "\" & FONT_PROFILE_NAME
    font_num = GetProfileInt(SEC_FONT_INFO, ENTR_FONT_NUM, 0, ini_path)
    ReDim TMFont(font_num)
    
    For i = 0 To font_num - 1
        wk_sec_name = "FONT_" & Format$(i + 1, "0000")
        len_buff = GetProfileStr(wk_sec_name, ENTR_FONT_NAME, "", buff, SIZE_PROFILE_DATA, ini_path)
        If (len_buff > 0) Then
            wk_len = Len(Trim$(buff)) - 1
            TMFont(i).Name = Left$(buff, wk_len): buff = ""
            TMFont(i).num = GetProfileInt(wk_sec_name, ENTR_SIZE_NUM, 0, ini_path)
            wk_len = GetProfileStr(wk_sec_name, ENTR_SIZE_1, "", buff, SIZE_PROFILE_DATA, ini_path)
            TMFont(i).Size(0) = Left$(buff, wk_len): buff = ""
            wk_len = GetProfileStr(wk_sec_name, ENTR_SIZE_2, "", buff, SIZE_PROFILE_DATA, ini_path)
            TMFont(i).Size(1) = Left$(buff, wk_len): buff = ""
            TMFont(i).Type = GetProfileInt(wk_sec_name, ENTR_FONT_TYPE, 0, ini_path)
        End If
    Next i
    intPFontCount = font_num - 1

    intBFontCount = font_num - 1
    Init_TMPrinterData = True
    
    Exit Function
ERROR_EXIT:
    m_tagErrInfo.strErrDate = Format(Now, "yyyy-mm-dd hh:mm:ss")
    m_tagErrInfo.strErrFile = "Init_TMPrinterData"
    m_tagErrInfo.strErrFunc = "modPrintSys"
    m_tagErrInfo.nErrNum = Err.Number
    m_tagErrInfo.strErrDesc = Error(Err.Number)
    If Err.Number <> 0 Then Err.Clear
    modErrorInfo.WriteErrLog m_tagErrInfo
    
    Init_TMPrinterData = False
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -