﻿Imports Bt
Imports Bt.ScanLib
Imports Bt.FileLib
Imports Bt.SysLib
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Threading
Imports System.IO
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Text.RegularExpressions
Imports Microsoft.WindowsCE.Forms
Imports Microsoft.VisualBasic.CompilerServices

'*******************************************************************************
'* ì¬ŽÒ   : Š”Ž®‰ïŽÐƒGƒR[EƒVƒXƒeƒ€ 
'* ì¬“ú   : 2004/10/02
'* ŠT—v     : PICS2004 ‹¤’Êˆ—
'* XV—š—ð : 
'* ÊÞ°¼Þ®Ý  : 1.0
'*******************************************************************************



Module modPublic


    '*******************************************************************************
    '   ŠT—vF“ú•tƒ`ƒFƒbƒNƒ‚[ƒh(fCheckDateŠÖ”‚Ì“ú•tƒ`ƒFƒbƒNŒ`Ž®)
    '*******************************************************************************
    Public Const G_CONST_CHK_YEAR_DATE As Integer = 0   '”NŒŽ“úŒ`Ž®
    Public Const G_CONST_CHK_MONTH_DATE As Integer = 1  'ŒŽ“úŒ`Ž®
    Public Const G_CONST_CHK_YEAR_MONTH As Integer = 2  '”NŒŽŒ`Ž®
    '*******************************************************************************
    '   ŠT—vFŽžƒ`ƒFƒbƒNƒ‚[ƒh(fCheckTimeŠÖ”‚Ì“ú•tƒ`ƒFƒbƒNŒ`Ž®)
    '*******************************************************************************
    Public Const G_CONST_CHK_HHMM As Integer = 0   'Žž•ªŒ`Ž®
    Public Const G_CONST_CHK_HHMMSS As Integer = 1  'Žž•ª•bŒ`Ž®
    '*******************************************************************************
    '   ŠT—vFƒƒbƒZ[ƒW–ß‚è’l
    '*******************************************************************************
    Public Enum MSG_RET As Integer
        OK = 1
        ABORT = 2
        RETRY = 3
        IGNORE = 4
        CANCEL = 5
        YES = 6
        NO = 7
    End Enum
    '*******************************************************************************
    '   ŠT—vFKey“ü—Í§ŒÀ
    '*******************************************************************************
    Public Enum KEY As Integer
        Number = 1
        Alpha = 2
        NumAlpha = 3
        TelPost = 4
        NumberDec = 5
        DateShift = 6
    End Enum
    '*******************************************************************************
    '   ŠT—vFˆ—ƒƒOo—Í‹æ•ª
    '*******************************************************************************
    Public Enum EVENT_RTN As Integer
        JOB_SRT = 1
        JOB_NML = 2
        JOB_ERR = 3
        DAT_ERR = 4
        DAT_NON = 5
    End Enum

    '*******************************************************************************
    '   •Ï”
    '*******************************************************************************

    '*******************************************************************************
    '* ‹@”\     : ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Ì‰Šúˆ—‚ðs‚¢‚Ü‚·
    '* ˆø”     : pstrPrgID    String  ‹N“®ƒvƒƒOƒ‰ƒ€IDiŠg’£Žq–³‚µ)
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fAppInit(ByVal pstrPrgID As String) As Boolean

        fAppInit = False
        gAppName = fGetAppName()

        ''// “ñd‹N“®‚Ì–hŽ~
        'gobjMutex = New System.Threading.Mutex(False, gAppName)
        'If gobjMutex.WaitOne(0, False) = False Then
        '    Application.Exit()
        'End If

        '// INIÌ§²Ù“Ç‚Ýž‚Ý
        If fGetIniPics() = False Then Exit Function
        If fGetIniParam(pstrPrgID) = False Then Exit Function

        '// ‹N“®Ó°ÄÞ¾¯Ä
        If gstrctParamIni.intKeyCount = 0 Then
            gintAppMode = G_CONST_APP_NEW
        Else
            gintAppMode = G_CONST_APP_UPD
        End If

        '// DBÚ‘±
        'If gclsDB.fOpenDB(gstrctPicsIni.strMain_PICS2004) = False Then
        '    sErrLog(gAppName, "fAppInit", gclsDB.ErrMsg)
        '    MsgBox("DB OPEN ERROR", MsgBoxStyle.Critical)
        '    Exit Function
        'End If

        fAppInit = True

    End Function

    '*******************************************************************************
    '* ‹@”\     : ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Ì‰Šúˆ—‚ðs‚¢‚Ü‚·
    '* ˆø”     : pobjForm     Object  Ì«°Ñ
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Sub sFormStandardSetting(ByVal pobjForm As Form)
        ' Calculate the center point of the screen
        Dim screenWidth As Integer = Screen.PrimaryScreen.Bounds.Width
        Dim screenHeight As Integer = Screen.PrimaryScreen.Bounds.Height
        Dim formWidth As Integer = pobjForm.Width
        Dim formHeight As Integer = pobjForm.Height
        Dim centerX As Integer = (screenWidth - formWidth) \ 2
        Dim centerY As Integer = (screenHeight - formHeight) \ 2

        pobjForm.MaximizeBox = False
        pobjForm.MinimizeBox = True
        pobjForm.FormBorderStyle = FormBorderStyle.FixedDialog

        'pobjForm.StartPosition = FormStartPosition.CenterScreen


        ' Set the form's location to the calculated center point
        pobjForm.Location = New System.Drawing.Point(centerX, centerY)


    End Sub

    '*******************************************************************************
    '* ‹@”\     : Pics.INIÌ§²Ù‚æ‚èî•ñ‚ð“Ç‚Ýž‚Ý\‘¢‘Ì‚É¾¯Ä‚µ‚Ü‚·
    '* ˆø”     : 
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fGetIniPics() As Boolean
        Dim wstrBuf As String

        Try
            '// PICS.INI‚ÌÌ§²ÙÊß½Žæ“¾
            gstrPicsIniPath = fgetAppPath() & G_CONST_PICSINI

            '// PICS.INI“Ç‚Ýž‚Ý
            With gstrctPicsIni
                .strImport_SPM = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec01, G_CONST_PicsKey01)
                .strImport_PLAN = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec01, G_CONST_PicsKey02)
                .strImport_RCVJUMP = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec01, G_CONST_PicsKey03)
                .strImport_MCLOCATION = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec01, G_CONST_PicsKey04)
                .strImport_MATERIAL = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec01, G_CONST_PicsKey05)

                .strMain_PICS2004 = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec02, G_CONST_PicsKey06)

                .strExport_SENDJUMP = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec03, G_CONST_PicsKey07)
                .strExport_SENDPACK1 = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec03, G_CONST_PicsKey08)
                .strExport_SENDPACK2 = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec03, G_CONST_PicsKey09)
                .strExport_SENDVAN = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec03, G_CONST_PicsKey10)

                .strErrorLog_Path = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec04, G_CONST_PicsKey11)

                .strParameter_Path = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec05, G_CONST_PicsKey12)

                .strConstant_DataKeepYear = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec06, G_CONST_PicsKey13)
                .strConstant_EditDate = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec06, G_CONST_PicsKey14)
                .strConstant_WaitTime = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec06, G_CONST_PicsKey28)

                .strOutput_PICSC = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec07, G_CONST_PicsKey15)
                .strOutput_PICSH = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec07, G_CONST_PicsKey16)
                .strOutput_PICSI = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec07, G_CONST_PicsKey17)
                .strOutput_PICSM = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec07, G_CONST_PicsKey18)
                .strOutput_KDPA = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec07, G_CONST_PicsKey19)
                .strOutput_KDST = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec07, G_CONST_PicsKey26)
                .strOutput_KDPP = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec07, G_CONST_PicsKey27)
                .strOutput_KDPL = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec07, G_CONST_PicsKey29)

                .strLabelWork_LABELWORK = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec08, G_CONST_PicsKey20)
                .strMtlWork_MTLWORK = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec09, G_CONST_PicsKey21)
                .strWork_PSERIAL = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec10, G_CONST_PicsKey22)
                .strWork_FREELOCATION = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec11, G_CONST_PicsKey23)
                .strWork_LOOKLCTN = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec12, G_CONST_PicsKey24)
                .strPicsc114_Def = gclsReg.fGetIniValue(gstrPicsIniPath, G_CONST_PicsSec13, G_CONST_PicsKey25)
            End With

            Return True
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fGetIniPics", ex.ToString)
            Return False
        End Try

    End Function

    '*******************************************************************************
    '* ‹@”\     : PICSPARAM.INIÌ§²Ù‚æ‚èî•ñ‚ð“Ç‚Ýž‚Ý\‘¢‘Ì‚É¾¯Ä‚µ‚Ü‚·
    '* ˆø”     : pstrPrgID    String@ƒvƒƒOƒ‰ƒ€IDiŠg’£Žq–³‚µj
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fGetIniParam(ByVal pstrPrgID As String) As Boolean
        Dim wstrBuf As String

        Try

            '// PICSPARAM.INI‚ÌÌ§²ÙÊß½Žæ“¾
            gstrParamIniPath = fgetAppPath() & G_CONST_PARAMINI

            '// PICS.INI“Ç‚Ýž‚Ý
            With gstrctParamIni
                .strUserID = gclsReg.fGetIniValue(gstrParamIniPath, G_CONST_ParamSec01, G_CONST_ParamKey01)
                .strProgramID = gclsReg.fGetIniValue(gstrParamIniPath, pstrPrgID, G_CONST_ParamKey02)
                If .strProgramID = "0" Then
                    .intKeyCount = 0
                Else
                    wstrBuf = gclsReg.fGetIniValue(gstrParamIniPath, pstrPrgID, G_CONST_ParamKey03)
                    'If Trim(wstrBuf) = "" Then
                    If Trim(wstrBuf).Replace(",", "") = "" Then
                        .intKeyCount = 0
                    Else
                        .intKeyCount = fStringSep(wstrBuf, ",", .strKey)
                        'KDST1000Ã·½Ä—p
                        'gstrctS1000.strdata = .strKey(0)

                    End If
                End If
            End With

            Return True
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fGetIniPics", ex.ToString)
            Return False
        End Try

    End Function

    '*******************************************************************************
    '* ‹@”\     : Relese.INIÌ§²Ù‚æ‚èî•ñ‚ð“Ç‚Ýž‚Ý\‘¢‘Ì‚É¾¯Ä‚µ‚Ü‚·
    '* ˆø”     : 
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fGetIniRelese() As Boolean
        Dim wstrBuf As String

        Try
            '// RELESE.INI‚ÌÌ§²ÙÊß½Žæ“¾
            gstrReleceIniPath = fgetAppPath() & G_CONST_RELECEINI

            '// RELESE.INI“Ç‚Ýž‚Ý
            With gstrctReleceIni
                .strProduction = gclsReg.fGetIniValue(gstrReleceIniPath, G_CONST_RelecSec01, G_CONST_RelecKey01)
                .strShipPlan = gclsReg.fGetIniValue(gstrReleceIniPath, G_CONST_RelecSec01, G_CONST_RelecKey02)
                .strProductFrom = gclsReg.fGetIniValue(gstrReleceIniPath, G_CONST_RelecSec01, G_CONST_RelecKey03)
                .strProductTo = gclsReg.fGetIniValue(gstrReleceIniPath, G_CONST_RelecSec01, G_CONST_RelecKey04)
            End With

            Return True
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fGetIniRelese", ex.ToString)
            Return False
        End Try

    End Function
    '*******************************************************************************
    '* ‹@”\     : ZAIKO.INIÌ§²Ù‚æ‚èî•ñ‚ð“Ç‚Ýž‚Ý\‘¢‘Ì‚É¾¯Ä‚µ‚Ü‚·
    '* ˆø”     : 
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fGetIniZaiko() As Boolean
        Dim wstrBuf As String

        Try
            '// Zaiko.INI‚ÌÌ§²ÙÊß½Žæ“¾
            gstrZaikoIniPath = fgetAppPath() & G_CONST_ZAIKOINI

            '// Zaiko.INI“Ç‚Ýž‚Ý
            With gstrctZaikoIni
                .strDate = gclsReg.fGetIniValue(gstrZaikoIniPath, G_CONST_ZaikoSec01, G_CONST_ZaikoKey01)

            End With

            Return True
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fGetIniZaiko", ex.ToString)
            Return False
        End Try

    End Function

    '*******************************************************************************
    '* ‹@”\     : APLINK.INIÌ§²Ù‚æ‚èî•ñ‚ð“Ç‚Ýž‚Ý\‘¢‘Ì‚É¾¯Ä‚µ‚Ü‚·
    '* ˆø”     : 
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fGetCreateAPFlag() As Boolean
        Dim wstrBuf As String

        Try
            '// APLINK.INI‚ÌÌ§²ÙÊß½Žæ“¾
            gstrAPLinkIniPath = gstrctPicsIni.strMain_PICS2004 & "\" & G_CONST_APLINKINI

            '// APLINK.INI“Ç‚Ýž‚Ý
            With gstrctKDHT
                If UCase(gclsReg.fGetIniValue(gstrAPLinkIniPath, G_CONST_APLinkSec01, G_CONST_APLinkKey01)) = "ON" Then
                    .bLinkFlag = True
                End If
            End With

            Return True
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fGetCreateAPFlag", ex.ToString)
            Return False
        End Try

    End Function

    '*******************************************************************************
    '* ‹@”\     : KDMC.INIÌ§²Ù‚æ‚èî•ñ‚ð“Ç‚Ýž‚Ý\‘¢‘Ì‚É¾¯Ä‚µ‚Ü‚·
    '* ˆø”     : 
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fGetIniKdmc() As Boolean
        Dim wstrBuf As String

        Try
            '// KDMC.INI‚ÌÌ§²ÙÊß½Žæ“¾
            gstrKdmcIniPath = fgetAppPath() & G_CONST_KDMCINI

            '// KDMC.INI“Ç‚Ýž‚Ý
            With gstrctKdmcIni
                .strMain_PicsType = gclsReg.fGetIniValue(gstrKdmcIniPath, G_CONST_KdmcSec01, G_CONST_KdmcKey01)
                .strMain_CstmID = gclsReg.fGetIniValue(gstrKdmcIniPath, G_CONST_KdmcSec01, G_CONST_KdmcKey02)
                .strMain_CstmCode = gclsReg.fGetIniValue(gstrKdmcIniPath, G_CONST_KdmcSec01, G_CONST_KdmcKey03)
                .strMain_CenterCode = gclsReg.fGetIniValue(gstrKdmcIniPath, G_CONST_KdmcSec01, G_CONST_KdmcKey04)
                .strMain_Bhk = gclsReg.fGetIniValue(gstrKdmcIniPath, G_CONST_KdmcSec01, G_CONST_KdmcKey05)
                .strMain_SectionID = gclsReg.fGetIniValue(gstrKdmcIniPath, G_CONST_KdmcSec01, G_CONST_KdmcKey06)
                .strMain_SectionCode = gclsReg.fGetIniValue(gstrKdmcIniPath, G_CONST_KdmcSec01, G_CONST_KdmcKey07)
            End With

            Return True
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fGetIniKdmc", ex.ToString)
            Return False
        End Try

    End Function

    '*******************************************************************************
    '* ‹@”\     : ˆø”‚æ‚è“n‚³‚ê‚½î•ñ‚ðPICSPARAM.INIÌ§²Ù‚É¾¯Ä‚µ‚Ü‚·
    '* ˆø”     : pstrAppID    String@ƒvƒƒOƒ‰ƒ€IDiŠg’£Žq–³‚µj
    '*          : pstrPrgID    String@ProgramID(INIÌ§²Ù)
    '*          : pstrKey      String@key(INIÌ§²Ù)
    '* –ß‚è’l   : ³íI—¹Žž=True
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fPutIniParam(ByVal pstrAppID As String, ByVal pstrPrgID As String, ByVal ParamArray pstrKey() As String) As Boolean
        Dim wstrBuf As String
        Dim wblnRet As Boolean
        Dim i As Integer

        Try

            '// PICSPARAM.INI‚ÌÌ§²ÙÊß½Žæ“¾
            gstrParamIniPath = fgetAppPath() & G_CONST_PARAMINI

            '// PICSPARAM.INI“Ç‚Ýž‚Ý
            wblnRet = gclsReg.fPutIniValue(gstrParamIniPath, pstrAppID, G_CONST_ParamKey02, pstrPrgID)

            If pstrPrgID = "0" Then
                wblnRet = gclsReg.fPutIniValue(gstrParamIniPath, pstrAppID, G_CONST_ParamKey03, "")
            Else
                wstrBuf = ""
                For i = 0 To UBound(pstrKey)
                    If i = 0 Then
                        wstrBuf = pstrKey(i)
                    Else
                        wstrBuf &= "," & pstrKey(i)
                    End If
                Next
                wblnRet = gclsReg.fPutIniValue(gstrParamIniPath, pstrAppID, G_CONST_ParamKey03, wstrBuf)
            End If

            Return True
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fPutIniParam", ex.ToString)
            Return False
        End Try

    End Function

    '*******************************************************************************
    '* ‹@”\     : ƒGƒ‰[”­¶Žž‚ÉAÚ×‚ðƒƒOƒtƒ@ƒCƒ‹‚É“f‚«o‚µ‚Ü‚·
    '* ˆø”     : pstrPGName     String@ƒvƒƒOƒ‰ƒ€ID
    '            : pstrSubName    String  ƒvƒƒVƒWƒƒ[ID
    '            : plngErrCode    String  ƒGƒ‰[ƒR[ƒh
    '            : pstrErrName    String  ƒGƒ‰[ƒƒbƒZ[ƒW
    '* –ß‚è’l   : ‚È‚µ
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Sub sErrLog(ByVal pstrPGName As String, ByVal pstrSubName As String, ByVal pstrErrName As String)
        Dim wstrCode As String
        Dim wstrWorkCode As String
        Dim wstrDate As String
        Dim wstrTime As String
        Dim wstrRecord As String
        Dim wstrFileName As String
        Dim wintFileNum As Integer
        Dim wintRecCount As Integer
        Dim wintSpace As Integer
        Dim wstrSub As String
        Dim wstrPG As String
        Dim wintErrCode As Integer
        Dim wstrErrMsg As String

        Try

            wintSpace = 12 - Len(pstrPGName) ' ƒvƒƒOƒ‰ƒ€–¼‚Ì•¶Žš”‚ÌŽæ“¾‚ÆƒXƒy[ƒX‚ÌŒÂ”‚ÌŽæ“¾
            wstrPG = Left(pstrPGName & Space(wintSpace), 12) ' •Ï”—Ìˆæ‚ÖƒXƒy[ƒX‚ð•t‰Á‚µ‚Ä‘ã“ü

            wintSpace = 30 - Len(pstrSubName) ' ƒTƒuƒ‹[ƒ`ƒ“–¼‚Ì•¶Žš”‚ÌŽæ“¾‚ÆƒXƒy[ƒX‚ÌŒÂ”‚ÌŽæ“¾
            wstrSub = Left(pstrSubName & Space(wintSpace), 30) ' •Ï”—Ìˆæ‚ÖƒXƒy[ƒX‚ð•t‰Á‚µ‚Ä‘ã“ü

            wstrTime = fgetDefaultTime(":") ' "hh:mm:ss" ‚ð•Ô‚µ‚Ü‚·B
            wstrDate = fgetDefaultDate("/") ' "yyyy/mm/dd" ‚ð•Ô‚µ‚Ü‚·B

            'ƒ[ƒvƒGƒ‰[ƒƒbƒZ[ƒW‚ÌŽæ“¾
            If pstrErrName.IndexOf("WarpError") > 0 Then

                'f0.WarpCtrl1.GetLastError(wintErrCode)

                wintErrCode = Bt.LibDef.BT_ERR

                Select Case wintErrCode
                    Case 10001
                        wstrErrMsg = "Screen not open."
                        'wstrErrMsg = "‰æ–Ê‚ªƒI[ƒvƒ“‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ"
                    Case 10002
                        wstrErrMsg = "Object non support."
                        'wstrErrMsg = "ƒIƒuƒWƒFƒNƒg‚ªƒTƒ|[ƒg‚³‚ê‚Ä‚¢‚È‚¢‹@”\‚ð—˜—p‚µ‚Ü‚µ‚½"
                    Case 10003
                        wstrErrMsg = "Screen open over."
                        'wstrErrMsg = "‰æ–Ê‚ª‚»‚êˆÈãƒI[ƒvƒ“‚Å‚«‚Ü‚¹‚ñ"
                    Case 10004
                        wstrErrMsg = "Memory over flow."
                        'wstrErrMsg = "ƒƒ‚ƒŠ‚Ì‹ó‚«—e—Ê‚ª‘«‚è‚Ü‚¹‚ñ"
                    Case 10005
                        wstrErrMsg = "Parameter error."
                        'wstrErrMsg = "ƒpƒ‰ƒ[ƒ^“™‚ªˆê’v‚µ‚Ä‚¢‚Ü‚¹‚ñ"
                    Case 10006
                        wstrErrMsg = "Screen double open."
                        'wstrErrMsg = "ƒI[ƒvƒ“‚³‚ê‚Ä‚¢‚é‰æ–Ê‚ð‚³‚ç‚ÉƒI[ƒvƒ“‚µ‚Ü‚µ‚½"
                    Case 10009
                        wstrErrMsg = "I/O error."
                        'wstrErrMsg = "IOƒGƒ‰["
                    Case 10010
                        wstrErrMsg = "Screen error. Object used."
                        'wstrErrMsg = "ƒI[ƒvƒ“‚³‚ê‚Ä‚¢‚È‚¢‰æ–Ê‚ÉƒIƒuƒWƒFƒNƒg‚ð—˜—p‚µ‚Ü‚µ‚½"
                    Case 20000
                        wstrErrMsg = "Not initialize."
                        'wstrErrMsg = "‰Šú‰»‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ"
                    Case 20001
                        wstrErrMsg = "Initialize parameter error."
                        'wstrErrMsg = "‰Šú‰»‚Ìƒpƒ‰ƒ[ƒ^‚ªˆá‚¢‚Ü‚·"
                    Case 20002
                        wstrErrMsg = "Parameter error."
                        'wstrErrMsg = "ƒpƒ‰ƒ[ƒ^‚ªˆá‚¢‚Ü‚·"
                    Case 20003
                        wstrErrMsg = "Not object."
                        'wstrErrMsg = "ƒIƒuƒWƒFƒNƒg‚ª‘¶Ý‚µ‚Ü‚¹‚ñ"
                    Case 20004
                        wstrErrMsg = "The buffer doesn't exist in the bar code buffer."
                        'wstrErrMsg = "ƒo[ƒR[ƒhƒoƒbƒtƒ@‚Éƒoƒbƒtƒ@‚ª‘¶Ý‚µ‚Ü‚¹‚ñ"
                    Case 20005
                        wstrErrMsg = "Warp message error."
                        'wstrErrMsg = "ƒ[ƒv‚ÌƒƒbƒZ[ƒWƒGƒ‰["
                    Case 30000
                        wstrErrMsg = "MORS network error."
                        'wstrErrMsg = "MORS‚Ìƒlƒbƒgƒ[ƒN‚ÉˆÙí‚ª”­¶‚µ‚Ü‚µ‚½"
                    Case 30001
                        wstrErrMsg = "MORS is not running."
                        'wstrErrMsg = "MORS‚ª‰Ò“®‚µ‚Ä‚¢‚Ü‚¹‚ñ"
                    Case 30002
                        wstrErrMsg = "MORS frame error."
                        'wstrErrMsg = "MORS‚ª’ÊM˜H‚ÌŠm—§‚ÉŽ¸”s‚µ‚Ü‚µ‚½"
                    Case 30003
                        wstrErrMsg = "MORS data send error."
                        'wstrErrMsg = "MORS‚ªƒf[ƒ^‚Ì‘—M‚ÉŽ¸”s‚µ‚Ü‚µ‚½"
                    Case 30004
                        wstrErrMsg = "MORS data recive error."
                        'wstrErrMsg = "MORS‚ªƒf[ƒ^‚ÌŽóM‚ÉŽ¸”s‚µ‚Ü‚µ‚½"
                    Case 30005
                        wstrErrMsg = "MORS wait error."
                        'wstrErrMsg = "MORS‚ÌƒEƒGƒCƒgƒGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½"
                End Select

                wstrErrMsg = "WarpError:" & wstrErrMsg

                ' wstrRecord ‚ÉŽæ“¾‚µ‚½ƒpƒ‰ƒ[ƒ^‚ð•ÒW‚µ‚ÄŠi”[
                wstrRecord = wstrDate & "   " & wstrTime & "   " & gstrctKDHT.strHdNo & "   " & wstrPG & "   " & wstrSub & "   " & wstrErrMsg

            Else

                ' wstrRecord ‚ÉŽæ“¾‚µ‚½ƒpƒ‰ƒ[ƒ^‚ð•ÒW‚µ‚ÄŠi”[
                wstrRecord = wstrDate & "   " & wstrTime & "   " & gstrctKDHT.strHdNo & "   " & wstrPG & "   " & wstrSub & "   " & pstrErrName

            End If

            'wintFileNum = FreeFile() ' ƒtƒŠ[‚Ìƒtƒ@ƒCƒ‹ƒiƒ“ƒo[‚ðŽæ“¾

            'wstrFileName = Trim(gstrctPicsIni.strErrorLog_Path)
            'If wstrFileName = "" Then wstrFileName = ".\PICSERR.LOG"
            '' o—Íƒtƒ@ƒCƒ‹‚ÌƒI[ƒvƒ“
            'FileOpen(wintFileNum, wstrFileName, OpenMode.Append)

            'PrintLine(wintFileNum, wstrRecord) 'ƒƒO‚Ì‘‚«o‚µ
            'FileClose(wintFileNum) ' o—Íƒtƒ@ƒCƒ‹‚ÌƒNƒ[ƒY

            wstrFileName = Trim(gstrctPicsIni.strErrorLog_Path)
            If wstrFileName = "" Then wstrFileName = ".\PICSERR.LOG"

            wstrFileName = LOG_DIR + "PICSERR.LOG"

            'If File.Exists(wstrFileName) = False Then
            '    File.Create(wstrFileName)
            'End If

            Using writer As StreamWriter = New StreamWriter(wstrFileName, True)
                ' Write the record to the file
                writer.WriteLine(wstrRecord)
            End Using

            'Using writer As New StreamWriter(wstrFileName, True) ' Open file for appending
            '    writer.WriteLine(wstrRecord)
            'End Using

            Exit Sub

        Catch ex As Exception

            'f0.WarpCtrl1.MessageBox(G_CONST_EMT_FILEIO, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)

            MessageBox.Show(G_CONST_EM_FILEIO, G_CONST_EMT_FILEIO, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)

        End Try

    End Sub

    '*******************************************************************************
    '* ‹@”\     : ˆ—“à—e‚ðƒƒOƒtƒ@ƒCƒ‹‚É“f‚«o‚µ‚Ü‚·
    '* ˆø”     : pstrPath     String@ƒtƒ@ƒCƒ‹ƒpƒX
    '           : pstrPGName   String  ƒvƒƒOƒ‰ƒ€ID
    '           : pintIvent    Integer ˆ—ƒƒbƒZ[ƒW
    '           : pstrMsg      String  Ú×ƒƒbƒZ[ƒW
    '           : pstrNaiyou   String  Ú×“à—e
    '* –ß‚è’l   : ‚È‚µ
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Sub sOutputLog(ByVal pstrPath As String, ByVal pstrMsgNo As String, Optional ByVal pstrTrueScan As String = " ", Optional ByVal pstrFalseScan As String = " ")

        'Dim wstrRecord As String
        'Dim wstrFileName As String
        'Dim wintFileNum As Integer

        'Try
        '    wstrRecord = fgetDefaultDate()         '¼½ÃÑ“ú•t
        '    wstrRecord &= fgetDefaultTime()        '¼½ÃÑŽž
        '    wstrRecord &= gstrctKDHT.strUserNo
        '    wstrRecord &= Space(1) & Space(8)
        '    wstrRecord &= gstrctKDHT.strPrgID
        '    wstrRecord &= pstrMsgNo
        '    wstrRecord &= Space(1) & Space(30)
        '    pstrTrueScan = pstrTrueScan.PadRight(40)
        '    wstrRecord &= pstrTrueScan
        '    pstrFalseScan = pstrFalseScan.PadRight(40)
        '    wstrRecord &= pstrFalseScan
        '    wstrRecord &= Space(14)

        '    wintFileNum = FreeFile() ' ƒtƒŠ[‚Ìƒtƒ@ƒCƒ‹ƒiƒ“ƒo[‚ðŽæ“¾

        '    wstrFileName = Trim(pstrPath)
        '    If wstrFileName = "" Then wstrFileName = "C:\HTERRLOG.TXT"
        '    ' o—Íƒtƒ@ƒCƒ‹‚ÌƒI[ƒvƒ“
        '    FileOpen(wintFileNum, wstrFileName, OpenMode.Append)

        '    PrintLine(wintFileNum, wstrRecord) 'ƒƒO‚Ì‘‚«o‚µ
        '    FileClose(wintFileNum) ' o—Íƒtƒ@ƒCƒ‹‚ÌƒNƒ[ƒY

        '    Exit Sub

        'Catch ex As Exception
        '    f0.WarpCtrl1.MessageBox(G_CONST_EMT_FILEIO, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)
        'End Try
        Dim wstrRecord As String
        Dim wstrFileName As String

        Try
            wstrRecord = fgetDefaultDate()         ' Append default date
            wstrRecord &= fgetDefaultTime()        ' Append default time
            wstrRecord &= gstrctKDHT.strUserNo
            wstrRecord &= Space(1) & Space(8)
            wstrRecord &= gstrctKDHT.strPrgID
            wstrRecord &= pstrMsgNo
            wstrRecord &= Space(1) & Space(30)
            pstrTrueScan = pstrTrueScan.PadRight(40)
            wstrRecord &= pstrTrueScan
            pstrFalseScan = pstrFalseScan.PadRight(40)
            wstrRecord &= pstrFalseScan
            wstrRecord &= Space(14)

            wstrFileName = Trim(pstrPath)
            'If wstrFileName = "" Then wstrFileName = "C:\HTERRLOG.TXT"

            wstrFileName = LOG_DIR + "HTERRLOG.TXT"

            Using writer As StreamWriter = New StreamWriter(wstrFileName, True)
                ' Write the record to the file
                writer.WriteLine(wstrRecord)
            End Using

            ' Append the record to the log file
            'Using writer As New StreamWriter(wstrFileName, True)
            '    writer.WriteLine(wstrRecord)
            'End Using
        Catch ex As Exception
            'f0.WarpCtrl1.MessageBox(G_CONST_EMT_FILEIO, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)
            MessageBox.Show(G_CONST_EM_FILEIO, G_CONST_EMT_FILEIO, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
        End Try

    End Sub

    '*******************************************************************************
    '* ‹@”\     : ƒvƒƒOƒ‰ƒ€ID‚ðŽæ“¾‚·‚é
    '* –ß‚è’l   : String@ƒJƒŒƒ“ƒgƒfƒBƒŒƒNƒgƒŠ
    '* @@     : Žæ“¾Ž¸”sŽž‚Í‹ó•¶Žš‚ð•Ô‹p
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fGetPrgID() As String
        Dim wstrAppName As String
        On Error Resume Next

        wstrAppName = fGetAppName()
        wstrAppName = Left(wstrAppName, Len(wstrAppName) - 4)

        Return wstrAppName

    End Function
    '*******************************************************************************
    '* ‹@”\     : ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÌƒJƒŒƒ“ƒgƒfƒBƒŒƒNƒgƒŠ‚ðŽæ“¾‚·‚é
    '* –ß‚è’l   : String@ƒJƒŒƒ“ƒgƒfƒBƒŒƒNƒgƒŠ
    '* @@     : Žæ“¾Ž¸”sŽž‚Í‹ó•¶Žš‚ð•Ô‹p
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fGetAppName() As String
        Dim wstrAppName As String
        On Error Resume Next

        wstrAppName = ""
        wstrAppName = System.AppDomain.CurrentDomain.FriendlyName

        Return wstrAppName

    End Function

    '*******************************************************************************
    '* ‹@”\     : ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÌƒJƒŒƒ“ƒgƒfƒBƒŒƒNƒgƒŠ‚ðŽæ“¾‚·‚é
    '* –ß‚è’l   : String@ƒJƒŒƒ“ƒgƒfƒBƒŒƒNƒgƒŠi––”ö‚É"\"•t‰Áj
    '* @@     : Žæ“¾Ž¸”sŽž‚Í‹ó•¶Žš‚ð•Ô‹p
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fgetAppPath() As String

        Dim assemblyPath As String = Assembly.GetExecutingAssembly().GetName().CodeBase
        Dim assemblyUri As New Uri(assemblyPath)
        Dim assemblyDirectory As String = Path.GetDirectoryName(assemblyUri.LocalPath)

        On Error Resume Next

        'assemblyDirectory = ""

        ''ƒJƒŒƒ“ƒgƒfƒBƒŒƒNƒgƒŠŽæ“¾
        'wstrPath = System.Environment.CurrentDirectory

        assemblyDirectory += "\"

        Return assemblyDirectory
    End Function

    '*******************************************************************************
    '* ‹@”\     : •¶Žš—ñ‚ðÃÞØÐÀ‚Å•ªŠ„‚µ‚Ä•Ô‹p‚µ‚Ü‚·
    '* ˆø”     : pstrTarget     String@‘ÎÛ•¶Žš—ñ
    '            : pstrDelimiter  String  ÃÞØÐÀ
    '            : pstrResult()   String  •ªŠ„Œã•¶Žš—ñ”z—ñ
    '* –ß‚è’l   : •ªŠ„”
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fStringSep(ByVal strTarget As String, ByVal strDelimiter As String, ByRef strResult() As String) As Integer
        Dim wstrArray() As String

        wstrArray = Split(strTarget, strDelimiter)
        strResult = wstrArray
        Return wstrArray.Length

    End Function


    '*******************************************************************************
    '   ŠT—vFNULLƒ`ƒFƒbƒN(•¶Žš—ñ)
    '   Êß×Ò°ÀFdata, Object, ƒ`ƒFƒbƒN‘ÎÛ€–Ú
    '           ret, Object, ‰Šú’liÈ—ªŽž‚Í‹ó•¶Žšj
    '   –ß‚è’lFString@Null‚Ü‚½‚ÍDBNull‚ÌŽž‚ÍƒfƒtƒHƒ‹ƒg’lA
    '                   ‚»‚êˆÈŠO‚Ídata‚ð‚»‚Ì‚Ü‚Ü•Ô‹p
    '*******************************************************************************
    Public Function fcheckNullString(ByVal data As Object, Optional ByVal ret As String = "", Optional ByVal pbilTrimMode As Boolean = True) As String
        On Error GoTo checkNullString_ERR

        If IsNothing(data) Or IsDBNull(data) Then
            Return ret
        Else
            If pbilTrimMode Then
                Return Trim(data)
            Else
                Return data
            End If
        End If
        Exit Function

checkNullString_ERR:
        Return ret
    End Function


    '*******************************************************************************
    '   ŠT—vFNULLƒ`ƒFƒbƒN(”’l)
    '   Êß×Ò°ÀFdata, Object, ƒ`ƒFƒbƒN‘ÎÛ€–Ú
    '           ret, Object, ‰Šú’liÈ—ªŽž‚Í0j
    '   –ß‚è’lFInteger@Null‚Ü‚½‚ÍDBNull‚ÌŽž‚ÍƒfƒtƒHƒ‹ƒg’lA
    '                   ‚»‚êˆÈŠO‚Ídata‚ð‚»‚Ì‚Ü‚Ü•Ô‹p
    '*******************************************************************************
    Public Function fcheckNullInt(ByVal data As Object, Optional ByVal ret As Integer = 0) As Integer

        Try
            If IsNothing(data) Or IsDBNull(data) Then
                Return ret
            Else
                Return data
            End If

            Exit Function

        Catch ex As Exception
            Return ret
        End Try

    End Function


    '*******************************************************************************
    '   ŠT—vFƒVƒXƒeƒ€“ú•t‚ðYYYYMMDD‘Ž®‚Å•Ô‹p
    '   Êß×Ò°ÀF‚È‚µ
    '   –ß‚è’lFString@‘Ž®•ÏŠ·Œã‚Ì“ú•t•¶Žš—ñ
    '*******************************************************************************
    Public Function fgetDefaultDate(Optional ByVal pstrSep As String = "") As String
        Dim strY As String
        Dim strM As String
        Dim strD As String

        strY = Now.Year
        strM = Now.Month
        strM = strM.PadLeft(2, "0")
        strD = Now.Day
        strD = strD.PadLeft(2, "0")

        Return strY & pstrSep & strM & pstrSep & strD

    End Function

    '*******************************************************************************
    '   ŠT—vFƒVƒXƒeƒ€Žž‚ðHHNNSS‘Ž®‚Å•Ô‹p
    '   Êß×Ò°ÀF‚È‚µ
    '   –ß‚è’lFString@‘Ž®•ÏŠ·Œã‚Ì“ú•t•¶Žš—ñ
    '*******************************************************************************
    Public Function fgetDefaultTime(Optional ByVal pstrSep As String = "") As String
        Dim strH As String
        Dim strM As String
        Dim strS As String

        strH = Now.Hour
        strH = strH.PadLeft(2, "0")
        strM = Now.Minute
        strM = strM.PadLeft(2, "0")
        strS = Now.Second
        strS = strS.PadLeft(2, "0")

        Return strH + pstrSep + strM + pstrSep + strS

    End Function

    '*******************************************************************************
    '   ŠT—vF‘SŠp”¼Špƒ`ƒFƒbƒN
    '   Êß×Ò°ÀFPIstrChkstr ƒ`ƒFƒbƒN‚·‚é•¶Žš—ñ
    '           PIintChktype ƒ`ƒFƒbƒN‚·‚éƒ^ƒCƒv 0:”¼Šp 1:‘SŠp
    '   –ß‚è’lFƒ`ƒFƒbƒNOKF0@ƒ`ƒFƒbƒNNGF1
    '*******************************************************************************
    Public Function fchk_HanZenString(ByVal PIstrChkstr As String, _
            ByVal PIintChktype As Integer) As Integer

        Dim utfEnc As Encoding = New UTF8Encoding()
        Dim intStrLen As Integer
        Dim intStrByte As Integer

        intStrLen = PIstrChkstr.Length
        intStrByte = utfEnc.GetByteCount(PIstrChkstr)

        Select Case PIintChktype
            Case 0
                If intStrByte = intStrLen Then
                    fchk_HanZenString = 0
                Else
                    fchk_HanZenString = 1
                End If

            Case 1
                If intStrByte = (intStrLen * 2) Then
                    fchk_HanZenString = 0
                Else
                    fchk_HanZenString = 1
                End If

            Case Else

        End Select

    End Function


    '*******************************************************************************
    '   ŠT—vF”’lƒ`ƒFƒbƒNi”’lƒ`ƒFƒbƒNA‚×‚«æ•¶Žš—L–³ƒ`ƒFƒbƒNA‰~ƒ}[ƒNƒ`ƒFƒbƒNAƒJƒ“ƒ}ƒ`ƒFƒbƒNj
    '   Êß×Ò°ÀFpstrNum, String, ƒ`ƒFƒbƒN‘ÎÛ•¶Žš—ñ
    '   –ß‚è’lFBoolean@True ƒ`ƒFƒbƒNOKA@False ƒ`ƒFƒbƒNNG
    '*******************************************************************************
    Public Function fChkNum(ByVal pstrNum As String) As Boolean

        Try

            If Len(pstrNum.Trim) = 0 Then                          '–¢“ü—Íƒ`ƒFƒbƒN

                '–¢“ü—Í‚Ìê‡
                fChkNum = True
            Else
                '“ü—Í‚³‚ê‚Ä‚¢‚éê‡
                fChkNum = IsNumeric(pstrNum)                       '”’lƒ`ƒFƒbƒN
                fChkNum = fChkNum And InStr(pstrNum, "e") = 0     '‚×‚«æ•¶Žšƒ`ƒFƒbƒN
                fChkNum = fChkNum And InStr(pstrNum, "\") = 0     '‰~ƒ}[ƒNƒ`ƒFƒbƒN
                fChkNum = fChkNum And InStr(pstrNum, ",") = 0     'ƒJƒ“ƒ}ƒ`ƒFƒbƒN

                fChkNum = True

            End If

            Exit Function

        Catch ex As Exception
            fChkNum = False
        End Try

    End Function

    '*******************************************************************************
    '   ŠT—vFŽw’è“ú•t‚ðYYYYMMDD‘Ž®‚Å•Ô‹p
    '   Êß×Ò°ÀFValue, String, •ÏŠ·‘ÎÛ•¶Žš—ñ
    '   –ß‚è’lFString@‘Ž®•ÏŠ·Œã‚Ì“ú•t•¶Žš—ñ
    '                   •ÏŠ·Ž¸”sŽž‚Í‹ó•¶Žš‚ð•Ô‹p
    '*******************************************************************************
    Public Function fformatDateStr(ByVal Value As String) As String
        Dim ret As String
        Dim strChk As String
        Dim intLength As Integer

        Try
            '‹ó•¶Žš‚Í‰½‚à‚µ‚È‚¢
            intLength = Value.Length
            If intLength = 0 Then Return ""

            '"/"‚ª“ü—Í‚³‚ê‚Ä‚¢‚é‚©‚Ç‚¤‚©ƒ`ƒFƒbƒN
            If String.Compare(Value, "/") > 0 Then
                Value = Value.Replace("/", "")
            End If

            intLength = Value.Length

            'Œ…”ƒ`ƒFƒbƒN
            If intLength = 8 Then
                ret = Value

            ElseIf intLength = 6 Then
                '”N‚ð‚SŒ…‚É‚·‚é
                ret = "20" + Value

            ElseIf intLength = 4 Then
                '”N‚ð•t‰Á‚·‚é
                ret = CStr(Now.Year) + Value

            Else
                '‚»‚êˆÈŠO‚ÍŽó‚¯•t‚¯‚È‚¢
                ret = ""
            End If

            'YYYY/MM/DD‚É•ÏŠ·(•ÏŠ·ƒ`ƒFƒbƒN—p)
            strChk = ret.Substring(0, 4) + "/" + ret.Substring(4, 2) + "/" + ret.Substring(6, 2)

            '•ÏŠ·Œ‹‰Ê‚ª“ú•t•ÏŠ·‚Å‚«‚é‚©‚Ç‚¤‚©Šm”F
            If Not IsDate(strChk) Then ret = ""

            Return ret

        Catch ex As Exception
            Return ""
        End Try

    End Function


    '*******************************************************************************
    '   ŠT—vFƒOƒ[ƒoƒ‹ƒNƒ‰ƒX‚È‚Ç‚ð”jŠü‚ÌI—¹ˆ—
    '   Êß×Ò°ÀFfrmMe, Form, I—¹‚·‚éƒtƒH[ƒ€
    '   –ß‚è’lF
    '*******************************************************************************
    Public Sub sEnd(ByRef frmMe As Form)

        frmMe.Dispose()

        'If Not IsNothing(gclsDB) Then
        '    gclsDB = Nothing       'PerbasiveÚ‘±—p‚ÌƒCƒ“ƒXƒ^ƒ“ƒX”jŠü
        'End If

        'gobjMutex.Close()

        Application.Exit()

    End Sub

    '*******************************************************************************
    '   ŠT—vFƒOƒ[ƒoƒ‹ƒNƒ‰ƒX‚È‚Ç‚ð”jŠü‚ÌI—¹ˆ—
    '   Êß×Ò°ÀF
    '   –ß‚è’lF
    '*******************************************************************************
    Public Sub sEnd()

        'If Not IsNothing(gclsDB) Then
        '    gclsDB = Nothing       'PerbasiveÚ‘±—p‚ÌƒCƒ“ƒXƒ^ƒ“ƒX”jŠü
        'End If

        'gobjMutex.Close()

        Application.Exit()

    End Sub
    '*******************************************************************************
    '   ŠT—vFMsgBoxƒtƒH[ƒ€‚ðŒÄo‚·
    '   Êß×Ò°ÀFwMsgId, String, ƒƒbƒZ[ƒWID
    '           wDispMode, String, ƒ{ƒ^ƒ“•\Ž¦ƒtƒ‰ƒO (1:ƒ{ƒ^ƒ“@2:ƒo[ƒR[ƒh  3:4•b•\Ž¦)
    '           wMsgName, String, "@" ’u‚«Š·‚¦ƒƒbƒZ[ƒW
    '           wButton, String, ƒ{ƒ^ƒ“ID
    '           wIcon,  String, ƒAƒCƒRƒ“ID
    '   –ß‚è’lFString@MsgBoxƒtƒH[ƒ€I—¹Žž‚Ì‰Ÿ‰ºƒ{ƒ^ƒ“–¼
    '                   (ƒ{ƒ^ƒ“‚ª‚È‚¢ê‡‚ÍForm‚©‚ç"OK"‚ª•Ô‹p‚³‚ê‚é)
    '*******************************************************************************
    'Public Function fFnc_Msg(ByVal wMsgId As String, ByVal wDispMode As String, Optional ByVal wMsgName As String = "", _
    '                         Optional ByVal wMessage As String = "", Optional ByVal wButton As String = "", Optional ByVal wIcon As String = "") As Integer
    '    Dim wMsg As New clsMsg

    '    With wMsg
    '        .pDispMode = wDispMode
    '        .sMsgBox(wMsgId, wMsgName, wMessage, wButton, wIcon)
    '        Return .gintRtnCode
    '    End With

    'End Function

    '*******************************************************************************
    '   ŠT—vFTextBox•¶Žš—ñ“ü—Íƒ`ƒFƒbƒNˆ—
    '   Êß×Ò°ÀFobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckText(ByVal obj As System.Object, Optional ByVal pintTrimMode As Boolean = True) As Boolean
        Dim strText As String

        Try
            strText = fcheckNullString(DirectCast(obj, TextBox).Text(), "", pintTrimMode)
            If strText = "" Then
                fCheckText = False
                DirectCast(obj, TextBox).Focus()
                DirectCast(obj, TextBox).Text = ""
            Else
                fCheckText = True
                DirectCast(obj, TextBox).Text = strText
            End If
        Catch ex As Exception
            fCheckText = False
            Return False
        End Try
    End Function

    '*******************************************************************************
    '   ŠT—vFTextBox•¶Žš—ñ“ü—Íƒ`ƒFƒbƒNˆ—
    '   Êß×Ò°ÀFobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckInt(ByVal obj As System.Object, Optional ByVal min As System.Int64 = 0, Optional ByVal max As System.Int64 = -1) As System.Boolean
        Dim intValue As System.Int64
        Dim intMax As System.Int64
        Dim intCnt As System.Int32
        Dim intIndex As System.Int32

        'On Error GoTo CheckInt_ERR
        Try

            fCheckInt = True

            '“ü—Íƒf[ƒ^‚ª”’l‚Ìê‡
            If Microsoft.VisualBasic.IsNumeric(DirectCast(obj, TextBox).Text()) Then
                intValue = System.Convert.ToInt64(DirectCast(obj, TextBox).Text())
                'Å¬’lƒ`ƒFƒbƒN
                If min <= intValue Then
                    'Å‘å’l‚ªŽw’è‚³‚ê‚Ä‚¢‚éê‡
                    If max <> -1 Then
                        If max < intValue Then
                            fCheckInt = False
                        End If
                    Else 'Å‘å’l‚ªŽw’è‚³‚ê‚Ä‚¢‚È‚¢ê‡
                        'Å‘å’l‚ÌŽw’è‚ª‚È‚¢ê‡‚ÍÅ‘å“ü—ÍŒ…”=“ü—Í‰Â”\•¶Žš”,‘SŒ…9‚Å‚Åƒ`ƒFƒbƒN
                        intMax = 0
                        intCnt = DirectCast(obj, TextBox).MaxLength()
                        For intIndex = 1 To intCnt
                            intMax = (intMax * 10) + 9
                        Next
                        '“ü—Í’l‚ªÅ‘å’l‚ð’´‚¦‚Ä‚¢‚é
                        If intMax < intValue Then
                            fCheckInt = False
                        End If
                    End If
                Else '“ü—Í’l‚ªÅ¬’lˆÈ‰º
                    fCheckInt = False
                End If
            Else '“ü—Íƒf[ƒ^‚ª”’l‚Å‚È‚¢ê‡‚ÍƒGƒ‰[
                fCheckInt = False
            End If

        Catch ex As Exception
            fCheckInt = False
            Return False
        End Try
    End Function

    '*******************************************************************************
    '   ŠT—vFComboBox”’l“ü—Íƒ`ƒFƒbƒNˆ—
    '   Êß×Ò°ÀFobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckCombo(ByVal obj As System.Object) As Boolean
        Dim strText As String

        Try
            strText = fcheckNullString(DirectCast(obj, ComboBox).Text())
            DirectCast(obj, ComboBox).Text = strText
            If strText = "" Then
                DirectCast(obj, ComboBox).Focus()
                fCheckCombo = False
            Else
                fCheckCombo = True
            End If
        Catch ex As Exception
            fCheckCombo = False
            Return False
        End Try
    End Function

    '*******************************************************************************
    '   ŠT—vFTextBox“ú•t“ü—Íƒ`ƒFƒbƒNˆ—
    '   Êß×Ò°ÀFobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckDate(ByVal obj As System.Object, Optional ByVal mode As Integer = G_CONST_CHK_YEAR_DATE) As Boolean

        fCheckDate = False
        If fCheckDate(DirectCast(obj, TextBox).Text(), mode) Then
            fCheckDate = True
        Else
            DirectCast(obj, TextBox).Focus()
        End If
    End Function

    '*******************************************************************************
    '   ŠT—vF“ú•t•¶Žš—ñƒ`ƒFƒbƒNˆ—
    '   Êß×Ò°ÀFpstrDate  “ú•t•¶Žš—ñ
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckDate(ByVal pstrDate As String, Optional ByVal mode As Integer = G_CONST_CHK_YEAR_DATE) As Boolean
        Dim strText As String
        Dim strYear As String
        Dim strMonth As String
        Dim strDay As String
        Dim strDate As String
        Dim intLength As Integer

        fCheckDate = False
        strText = ""
        Try
            strText = fcheckNullString(pstrDate)
            intLength = strText.Length

            If mode = G_CONST_CHK_YEAR_DATE Then
                If intLength <> 8 Then
                    strText = ""
                Else
                    strYear = Left(strText, 4)
                    strText = Right(strText, 4)
                    intLength = intLength - 4
                End If
            ElseIf mode = G_CONST_CHK_YEAR_MONTH Then
                If intLength <> 6 Then
                    strText = ""
                Else
                    strYear = Left(strText, 4)
                    strText = Right(strText, 2)
                    intLength = intLength - 4
                End If
            Else
                strYear = Now().Year
            End If

            If strText <> "" Then
                If intLength = 4 Then
                    strMonth = Left(strText, 2)
                    strDay = Right(strText, 2)

                    strDate = strYear & "/" & strMonth & "/" & strDay
                    If G_CONST_CHK_MONTH_DATE = mode Then
                        strText = strMonth & strDay
                    Else
                        strText = strYear & strMonth & strDay
                    End If
                    fCheckDate = True

                    If Not IsDate(strDate) Then
                        fCheckDate = False
                        strText = ""
                    End If
                ElseIf intLength = 2 Then
                    strMonth = Left(strText, 2)
                    strDay = "01"
                    strDate = strYear & "/" & strMonth & "/" & strDay
                    strText = strYear & strMonth
                    fCheckDate = True

                    If Not IsDate(strDate) Then
                        fCheckDate = False
                        strText = ""
                    End If
                Else
                    strDate = strYear & "/" & strMonth & "/" & strDay
                    fCheckDate = True
                    If Not IsDate(strDate) Then
                        fCheckDate = False
                        strText = ""
                    End If
                End If
            Else
                strText = ""
            End If
            Return fCheckDate

        Catch ex As Exception
            Return False
        End Try
    End Function

    '*******************************************************************************
    '   ŠT—vFTextBoxŽž“ü—Íƒ`ƒFƒbƒNˆ—
    '   Êß×Ò°ÀFobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckTime(ByVal obj As System.Object, Optional ByVal mode As Integer = G_CONST_CHK_HHMM) As Boolean
        Dim strText As String

        strText = fcheckNullString(DirectCast(obj, TextBox).Text())

        If fCheckTime(DirectCast(obj, TextBox).Text(), mode) = False Then
            DirectCast(obj, TextBox).Text = strText
            DirectCast(obj, TextBox).Focus()
            fCheckTime = False
        Else
            DirectCast(obj, TextBox).Text = Microsoft.VisualBasic.Left(strText, strText.Length)
            fCheckTime = True
        End If

    End Function

    '*******************************************************************************
    '   ŠT—vFTextBoxŽž“ü—Íƒ`ƒFƒbƒNˆ—
    '   Êß×Ò°ÀFobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckTime(ByVal pstrTime As String, Optional ByVal mode As Integer = G_CONST_CHK_HHMM) As Boolean
        Dim strText As String
        Dim strHour As String
        Dim strMin As String
        Dim strSec As String
        Dim strTime As String
        Dim intLength As Integer

        fCheckTime = True

        Try
            strText = fcheckNullString(pstrTime)
            intLength = strText.Length

            If mode = G_CONST_CHK_HHMM Then
                If intLength = 3 Or intLength = 4 Then
                    '3Œ…(HMM)E4Œ…(HHMM)‚È‚çÁª¯¸
                    If intLength = 3 Then
                        strHour = fcheckNullString(Microsoft.VisualBasic.Left(strText, 1))
                        strMin = fcheckNullString(Microsoft.VisualBasic.Right(strText, 2))
                        strSec = "00"
                    Else
                        strHour = fcheckNullString(Microsoft.VisualBasic.Left(strText, 2))
                        strMin = fcheckNullString(Microsoft.VisualBasic.Right(strText, 2))
                        strSec = "00"
                    End If
                    intLength = 4
                Else
                    'Œ…”´×°
                    fCheckTime = False
                End If

            ElseIf mode = G_CONST_CHK_HHMMSS Then
                If intLength = 5 Or intLength = 6 Then
                    '5Œ…(HMMSS)E6Œ…(HHMMSS)‚È‚çÁª¯¸
                    If intLength = 5 Then
                        strHour = fcheckNullString(Microsoft.VisualBasic.Left(strText, 1))
                        strMin = fcheckNullString(Microsoft.VisualBasic.Mid(strText, 2, 2))
                        strSec = fcheckNullString(Microsoft.VisualBasic.Right(strText, 2))
                    Else
                        strHour = fcheckNullString(Microsoft.VisualBasic.Left(strText, 2))
                        strMin = fcheckNullString(Microsoft.VisualBasic.Mid(strText, 3, 2))
                        strSec = fcheckNullString(Microsoft.VisualBasic.Right(strText, 2))
                    End If
                    intLength = 6
                Else
                    'Œ…”´×°
                    fCheckTime = False
                End If
            End If

            'ŽžÁª¯¸
            If fCheckTime = True Then
                If IsNumeric(strHour) Then
                    If fcheckNullInt(strHour) >= 0 And fcheckNullInt(strHour) <= 23 Then
                        strTime = strHour.PadLeft(2, "0")
                    Else
                        'Žž´×°
                        fCheckTime = False
                    End If
                Else
                    fCheckTime = False
                End If
            End If

            '•ªÁª¯¸
            If fCheckTime = True Then
                If IsNumeric(strMin) Then
                    If fcheckNullInt(strMin) >= 0 And fcheckNullInt(strMin) <= 59 Then
                        strTime = strTime & strMin.PadLeft(2, "0")
                    Else
                        '•ª´×°
                        fCheckTime = False
                    End If
                Else
                    fCheckTime = False
                End If
            End If

            '•bÁª¯¸
            If fCheckTime = True Then
                If IsNumeric(strSec) Then
                    If fcheckNullInt(strSec) >= 0 And fcheckNullInt(strSec) <= 59 Then
                        strTime = strTime & strSec.PadLeft(2, "0")
                    Else
                        '•ª´×°
                        fCheckTime = False
                    End If
                Else
                    fCheckTime = False
                End If
            End If

            Return fCheckTime

        Catch ex As Exception
            fCheckTime = False
            Return False
        End Try
    End Function

    '/*
    '|| ŠÖ”–¼FfCheckIntZero
    '|| ŠT—v      FTextBox”’l“ü—Íƒ`ƒFƒbƒNˆ—
    '|| ˆø”      Fobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '*/
    Public Function fCheckIntZero(ByVal obj As System.Object, Optional ByVal min As System.Int64 = 0, Optional ByVal max As System.Int64 = -1) As System.Boolean

        fCheckIntZero = True

        Try
            '“ü—Íƒf[ƒ^‚ª”’l‚Ìê‡
            If fCheckInt(obj, min, max) Then
                DirectCast(obj, TextBox).Text = DirectCast(obj, TextBox).Text.PadLeft(DirectCast(obj, TextBox).MaxLength(), "0")
            Else
                fCheckIntZero = False
                DirectCast(obj, TextBox).Focus()
                DirectCast(obj, TextBox).Text = ""
            End If
        Catch ex As Exception
            fCheckIntZero = False
            Return False
        End Try
    End Function

    '/*
    '|| ŠÖ”–¼FfCheckIntZeroSupless
    '|| ŠT—v      FTextBox”’l“ü—Íƒ`ƒFƒbƒNˆ—
    '|| ˆø”      Fobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '*/
    Public Function fCheckIntZeroSupless(ByVal obj As System.Object, Optional ByVal min As System.Int64 = 0, Optional ByVal max As System.Int64 = -1) As System.Boolean
        Dim wintText As System.Int64
        Dim wstrText As System.String

        fCheckIntZeroSupless = True

        Try
            '“ü—Íƒf[ƒ^‚ª”’l‚Ìê‡
            If fCheckInt(obj, min, max) Then
                wintText = System.Convert.ToInt64(DirectCast(obj, TextBox).Text)
                wstrText = System.Convert.ToString(wintText)
                DirectCast(obj, TextBox).Text = wstrText
            Else 'Å‘å’l‚ªŽw’è‚³‚ê‚Ä‚¢‚È‚¢ê‡
                fCheckIntZeroSupless = False
                DirectCast(obj, TextBox).Focus()
                DirectCast(obj, TextBox).Text = ""
            End If
        Catch ex As Exception
            fCheckIntZeroSupless = False
            Return False
        End Try
    End Function

    '/*
    '|| ŠÖ”–¼FfCheckIntZeroSuplessAll
    '|| ŠT—v      FTextBox”’l“ü—Íƒ`ƒFƒbƒNˆ—
    '|| ˆø”      Fobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '*/
    Public Function fCheckIntZeroSuplessAll(ByVal obj As System.Object, Optional ByVal min As System.Int64 = 0, Optional ByVal max As System.Int64 = -1) As System.Boolean
        Dim wintText As System.Int64
        Dim wstrText As System.String

        fCheckIntZeroSuplessAll = True

        Try
            '“ü—Íƒf[ƒ^‚ª”’l‚Ìê‡
            If fCheckInt(obj, min, max) Then
                wintText = System.Convert.ToInt64(DirectCast(obj, TextBox).Text)
                wstrText = System.Convert.ToString(wintText)
                If wstrText = "0" Then
                    DirectCast(obj, TextBox).Text = ""
                Else
                    DirectCast(obj, TextBox).Text = wstrText
                End If
            Else 'Å‘å’l‚ªŽw’è‚³‚ê‚Ä‚¢‚È‚¢ê‡
                fCheckIntZeroSuplessAll = False
                DirectCast(obj, TextBox).Focus()
                DirectCast(obj, TextBox).Text = ""
            End If
        Catch ex As Exception
            fCheckIntZeroSuplessAll = False
            Return False
        End Try
    End Function

    '/*
    '|| ŠÖ”–¼FfCheckDbl
    '|| ŠT—v      FTextBox”’l“ü—Íƒ`ƒFƒbƒNˆ—
    '|| ˆø”      Fobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '*/
    Public Function fCheckDbl(ByVal obj As System.Object, ByVal dot As System.Int16, Optional ByVal min As System.Double = 0.0, Optional ByVal max As System.Double = -1) As System.Boolean

        fCheckDbl = False
        If fCheckDbl(DirectCast(obj, TextBox).Text(), _
                     DirectCast(obj, TextBox).MaxLength, _
                     dot, min, max) Then
            fCheckDbl = True
        End If
    End Function

    '/*
    '|| ŠÖ”–¼FfCheckDbl
    '|| ŠT—v      F•‚“®¬”“_•¶Žš—ñƒ`ƒFƒbƒNˆ—
    '|| ˆø”      FTrue OK False NG •‚“®¬”“_•¶Žš—ñ
    '*/
    Public Function fCheckDbl(ByVal pstrDbl As String, ByVal pintMaxLength As Integer, ByVal dot As System.Int16, _
                              Optional ByVal min As System.Double = 0.0, _
                              Optional ByVal max As System.Double = -1) As Boolean
        Dim wdblValue As System.Double
        Dim wintBeams As System.Int16 '®”•”Œ…”
        Dim wintDeciml As System.Int16  '¬”•”Œ…”
        Dim wintCnt As System.Int32
        Dim wintIndex As System.Int32
        Dim wdblMaxValue As System.Double
        Dim wdblTmp As System.Double

        fCheckDbl = True

        Try
            '®”•”Œ…”‚ðŽæ“¾
            wintBeams = pintMaxLength - dot
            '¬”“_ˆÈ‰ºŒ…”‚ðŽæ“¾
            wintDeciml = dot - 1

            'Å‘å’lŽZo
            If max = -1 Then
                wdblMaxValue = 0
                wdblTmp = 0.9
                '¬”“_ˆÈ‰ºŽZo
                For wintIndex = 1 To wintDeciml
                    wdblMaxValue = wdblMaxValue + wdblTmp
                    wdblTmp = wdblTmp / 10
                Next

                wdblTmp = 9
                '®”•”ŽZo
                For wintIndex = 1 To wintBeams
                    wdblMaxValue = wdblMaxValue + wdblTmp
                    wdblTmp = wdblTmp * 10
                Next
            End If

            '“ü—Íƒf[ƒ^‚ª”’l‚Ìê‡
            If Microsoft.VisualBasic.IsNumeric(pstrDbl) Then
                wdblValue = System.Convert.ToDouble(pstrDbl)
                'Å¬’lƒ`ƒFƒbƒN
                If min <= wdblValue Then
                    'Å‘å’l‚ªŽw’è‚³‚ê‚Ä‚¢‚éê‡
                    If max <> -1 Then
                        If max < wdblValue Then
                            fCheckDbl = False
                        End If
                    Else 'Å‘å’l‚ªŽw’è‚³‚ê‚Ä‚¢‚È‚¢ê‡
                        If wdblMaxValue < wdblValue Then
                            fCheckDbl = False
                        End If

                    End If
                Else
                    fCheckDbl = False
                End If
            Else '“ü—Íƒf[ƒ^‚ª”’l‚Å‚È‚¢ê‡‚ÍƒGƒ‰[
                fCheckDbl = False
            End If
        Catch ex As Exception
            fCheckDbl = False
            Return False
        End Try
    End Function

    '/*
    '|| ŠÖ”–¼FfCheckDblZeroSupless
    '|| ŠT—v      FTextBox”’l“ü—Íƒ`ƒFƒbƒNˆ—
    '|| ˆø”      Fobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '*/
    Function fCheckDblZeroSupless(ByVal obj As System.Object, ByVal dot As System.Int16, Optional ByVal min As System.Double = 0.0, Optional ByVal max As System.Double = -1) As Boolean
        Dim wstrValue As String

        fCheckDblZeroSupless = True

        wstrValue = fCheckDblZeroSuplessS(DirectCast(obj, TextBox).Text, DirectCast(obj, TextBox).MaxLength, dot, min, max)
        If wstrValue = "" Then
            fCheckDblZeroSupless = False
            DirectCast(obj, TextBox).Focus()
            DirectCast(obj, TextBox).Text = ""
        Else
            DirectCast(obj, TextBox).Text = wstrValue
        End If

    End Function

    '/*
    '|| ŠÖ”–¼FfCheckDblZeroSupless
    '|| ŠT—v      FTextBox”’l“ü—Íƒ`ƒFƒbƒNˆ—
    '|| ˆø”      Fobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '*/
    Function fCheckDblZeroSuplessS(ByVal pstrNum As String, ByVal pintMaxLength As Integer, ByVal dot As System.Int16, _
                                  Optional ByVal min As System.Double = 0.0, Optional ByVal max As System.Double = -1) As String
        Dim wstrFormat As System.String
        Dim wstrFormat2 As System.String
        Dim wintBeams As System.Int16 '®”•”Œ…”
        Dim wintDeciml As System.Int16  '¬”•”Œ…”
        Dim wdblValue As System.Double
        Dim wintIndex As System.Int32

        fCheckDblZeroSuplessS = ""

        Try
            If fCheckDbl(pstrNum, pintMaxLength, dot, min, max) Then
                '®”•”Œ…”‚ðŽæ“¾
                wintBeams = pintMaxLength - dot
                '¬”“_ˆÈ‰ºŒ…”‚ðŽæ“¾
                wintDeciml = dot - 1

                wstrFormat = ""
                '¬”“_ˆÈ‰ºŽZo
                For wintIndex = 1 To wintDeciml
                    wstrFormat = wstrFormat + "0"
                Next

                wstrFormat = "0." & wstrFormat
                wintBeams = wintBeams - 1
                wstrFormat2 = ""
                '®”•”ŽZo
                For wintIndex = 1 To wintBeams
                    wstrFormat2 = wstrFormat2 + "#"
                Next
                wstrFormat = wstrFormat2 + wstrFormat
                wdblValue = System.Convert.ToDouble(pstrNum)
                fCheckDblZeroSuplessS = wdblValue.ToString(wstrFormat)
            Else 'Å‘å’l‚ªŽw’è‚³‚ê‚Ä‚¢‚È‚¢ê‡
                fCheckDblZeroSuplessS = ""
            End If
        Catch ex As Exception
            fCheckDblZeroSuplessS = ""
            Return False
        End Try
    End Function

    '/*
    '|| ŠÖ”–¼FfChkOpenText
    '|| ŠT—v  Fƒtƒ@ƒCƒ‹ƒI[ƒvƒ“Šm”F
    '*/
    Public Function fChkOpenText(ByVal pstrFileName As String) As Boolean
        'Dim wintFileNum As Integer

        'Try

        '    wintFileNum = FreeFile() ' ƒtƒŠ[‚Ìƒtƒ@ƒCƒ‹ƒiƒ“ƒo[‚ðŽæ“¾

        '    'ƒtƒ@ƒCƒ‹‚ÌƒI[ƒvƒ“
        '    FileOpen(wintFileNum, pstrFileName, OpenMode.Input)

        '    'ƒtƒ@ƒCƒ‹‚ÌƒNƒ[ƒY
        '    FileClose(wintFileNum)

        '    fChkOpenText = True
        '    Exit Function

        'Catch ex As Exception
        '    fChkOpenText = False
        'End Try
        Try
            ' Create a StreamReader to attempt to open the file
            Using reader As New StreamReader(pstrFileName)
                ' Attempt to read a line to check if the file is accessible
                Dim line As String = reader.ReadLine()
            End Using

            ' If no exception is thrown, the file is accessible
            Return True
        Catch ex As Exception
            ' An exception occurred while attempting to open the file
            Return False
        End Try
    End Function

    '/*
    '|| ŠÖ”–¼FfChkOpenRecord
    '|| ŠT—v  FƒI[ƒvƒ“ƒŒƒR[ƒhƒ`ƒFƒbƒNˆ—
    '|| ˆø”  FclsDB,    clsDBAccess, DBƒIƒuƒWƒFƒNƒg
    '||       Fpstrtbl,  String,      ƒe[ƒuƒ‹–¼
    '||       Fpstrkey,  String,      ƒCƒ“ƒfƒbƒNƒX–¼
    '||       FpintMode, Integer,     ƒƒbƒZ[ƒWƒ{ƒbƒNƒX•\Ž¦
    '*/
    'Public Function fChkOpenRecord(ByVal clsDB As clsDBAccess, ByVal pstrtbl As String, ByVal pstrkey As String, Optional ByVal pintMode As Integer = 1) As Boolean

    '    Dim wintcnt As Integer

    '    fChkOpenRecord = False

    '    Try
    '        wintcnt = clsDB.fOpenRecord(pstrtbl, pstrkey, "CHK")
    '        If wintcnt = -1 Then
    '            If pintMode = 3 Then
    '                '4•bŒã‚É•Â‚¶‚éDBƒGƒ‰[ƒƒbƒZ[ƒWƒ{ƒbƒNƒX
    '                'fFnc_Msg("", "3", "", "DB Error.", "3", "S")
    '            Else
    '                'DBÚ‘±ƒGƒ‰[‚Ìê‡iŠJ”­—pj
    '                MsgBox("DB Error.")
    '                Exit Function
    '            End If
    '        End If

    '        clsDB.fCloseRecord("CHK")
    '        fChkOpenRecord = True

    '        Exit Function

    '    Catch ex As Exception
    '        sErrLog(gAppName, "fChkOpenRecord", ex.ToString)
    '    End Try
    'End Function

    '/*
    '|| ŠÖ”–¼FfGetIniData
    '|| ŠT—v  FƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Ì‰Šúˆ—‚ðs‚¢‚Ü‚·iPICSI—pj
    '|| ˆø”  FpstrPrgID    String  ‹N“®ƒvƒƒOƒ‰ƒ€IDiŠg’£Žq–³‚µ)
    '|| ˆø”  FpstrIniName  String  ˆ—’†‚ÌINIÌ§²Ù–¼
    '*/

    ' Function to check if a file exists in the application directory
    Public Function FileExistsInAppDirectory(ByVal fileName As String) As Boolean
        Dim appPath As String = fgetAppPath() ' Assuming fgetAppPath() retrieves the application directory
        Dim filePath As String = Path.Combine(appPath, fileName)

        Return File.Exists(filePath)
    End Function

    Public Function fGetIniData(ByVal pstrPrgID As String, ByRef pstrIniName As String) As Boolean

        fGetIniData = False

        gAppName = fGetAppName()
        pstrIniName = G_CONST_PICSINI

        '// “ñd‹N“®‚Ì–hŽ~
        'gobjMutex = New System.Threading.Mutex(False, gAppName)
        'If gobjMutex.WaitOne(0, False) = False Then
        'Application.Exit()
        'End If


        '// PICS.INIÌ§²Ù“Ç‚Ýž‚Ý
        'If Dir(fgetAppPath() & G_CONST_PICSINI) = "" Then Exit Function
        If Not FileExistsInAppDirectory(G_CONST_PICSINI) Then
            Exit Function ' Exit the function if the file does not exist
        End If


        If fGetIniPics() = False Then Exit Function

        '// PICSPARAM.INIÌ§²Ù“Ç‚Ýž‚Ý
        pstrIniName = G_CONST_PARAMINI
        'If Dir(fgetAppPath() & G_CONST_PICSINI) = "" Then Exit Function
        If Not FileExistsInAppDirectory(G_CONST_PICSINI) Then
            Exit Function ' Exit the function if the file does not exist
        End If


        'If fGetIniParam(pstrPrgID) = False Then Exit Function



        '// ‹N“®Ó°ÄÞ¾¯Ä
        If gstrctParamIni.intKeyCount = 0 Then
            gintAppMode = G_CONST_APP_NEW
        Else
            gintAppMode = G_CONST_APP_UPD
        End If

        fGetIniData = True

    End Function

    '/*
    '|| ŠÖ”–¼FfSerch_File
    '|| ŠT—v  Fƒtƒ@ƒCƒ‹ƒpƒXŒŸõˆ—
    '|| ˆø”  FwstrPath, String, ƒpƒX–¼
    '*/
    'Public Function fSerch_File(ByVal ParamArray wstrPath() As String) As Boolean
    'Dim strGetPath As String
    'Dim i As Integer
    'Dim wMessage As String

    'fSerch_File = False

    ''ƒpƒXƒ`ƒFƒbƒN
    'For i = 0 To UBound(wstrPath)
    '    strGetPath = Dir(wstrPath(i), FileAttribute.Normal)

    '    If strGetPath = "" Then
    '        wMessage = "File not found (*" & wstrPath(i) & "*)"
    '        'fFnc_Msg("0103", "1", , wMessage, "3", "S")
    '        Exit Function
    '    End If
    'Next

    'fSerch_File = True

    'End Function

    '/*
    '|| ŠÖ”–¼FfOpenDB
    '|| ŠT—v  FDBÚ‘±ˆ—
    '|| ˆø”  FpclsDB,     clsDBAccess, DBƒNƒ‰ƒX
    '||       FpstrDbPath, String,      ƒpƒX–¼
    '*/
    Public Function fOpenDB(ByVal pstrDbPath As String) As Boolean


        Dim wstrImage As String
        fOpenDB = False

        'DBÚ‘±
        'If gclsDB.fOpenDB(pstrDbPath) = False Then
        '    sErrLog(gAppName, "fOpenDB", gclsDB.ErrMsg)
        '    'MsgBox("DB OPEN ERROR", MsgBoxStyle.Critical)
        '    Exit Function
        'End If

        fOpenDB = True

    End Function

    '*******************************************************************************
    '* ‹@”\     : Žw’è‚³‚ê‚½•ÏŠ·ÊßÀ°Ý‚É]‚Á‚ÄAº°ÄÞ‚ð•\Ž¦—pº°ÄÞ‚É•ÏŠ·‚µ‚Ü‚·
    '* ˆø”     : pintPat        Integer •ÏŠ·ÊßÀ°Ý
    '           : pstrCode       String  •ÏŠ·Œ³º°ÄÞ
    '* –ß‚è’l   : •ÏŠ·Œã•\Ž¦—p•¶Žš—ñ String
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fDispItemChg(ByVal pintPat As DispItemChg, ByVal pstrCode As String) As String
        Dim wstrDispCode As String

        wstrDispCode = ""
        Select Case pintPat
            '// •ÏŠ·‚È‚µ
            Case 0 : wstrDispCode = pstrCode
                '// ÏÂÀÞ•ÏŠ·
            Case 1 : wstrDispCode = fChgMazda(pintPat, pstrCode)
        End Select
        Return wstrDispCode

    End Function
    '*******************************************************************************
    '* ƒ}ƒcƒ_•ÏŠ·
    '*******************************************************************************
    Private Function fChgMazda(ByVal pintPat As DispItemChg, ByVal pstrCode As String) As String
        'E •”•i”Ô†‚Ì1Œ…–Ú‚ªg9h‚Ìê‡
        '    æ“ª‚ª5•¶Žš(+"-" + Œã‚ë5•¶Žš)
        '@@u9123456780vËg91234-56780h
        '    Eã‹LˆÈŠO‚Ìê‡()
        '     6•¶Žš–Ú‚©‚ç4Œ…+ g-h +1•¶Žš–Ú‚©‚ç2Œ… + "-h+ 3•¶Žš–Ú‚©‚ç3Œ… + 10•¶Žš–Ú‚©‚ç1Œ… + " " +
        '     11•¶Žš–Ú + 12•¶Žš–Ú + " " +13•¶Žš–ÚˆÈ~
        '@@u1234567890ABCvËg6789-12-345-0 AB C h  ¦13Œ…–ÚˆÈ~‚ÍÊ²ÌÝ‚È‚µ‚Å––”ö‚É‚·‚×‚Ä•t‰Á‚·‚é
        Dim wstrChg As String
        Dim wstrArray(30) As String
        Dim i As Integer

        wstrChg = ""

        '// ”z—ñ‚É¾¯Ä
        For i = 1 To 30
            wstrArray(i) = Mid(pstrCode, i, 1)
        Next

        If wstrArray(1) = "9" Then
            wstrChg = wstrArray(1) & wstrArray(2) & wstrArray(3) & wstrArray(4) & wstrArray(5) & "-" & _
                      wstrArray(6) & wstrArray(7) & wstrArray(8) & wstrArray(9) & wstrArray(10) & _
                      wstrArray(11) & wstrArray(12) & wstrArray(13) & wstrArray(14) & wstrArray(15) & _
                      wstrArray(16) & wstrArray(17) & wstrArray(18) & wstrArray(19) & wstrArray(20) & _
                      wstrArray(21) & wstrArray(22) & wstrArray(23) & wstrArray(24) & wstrArray(25) & _
                      wstrArray(26) & wstrArray(27) & wstrArray(28) & wstrArray(29) & wstrArray(30)
        Else
            wstrChg = wstrArray(6) & wstrArray(7) & wstrArray(8) & wstrArray(9) & "-" & _
                      wstrArray(1) & wstrArray(2) & "-" & _
                      wstrArray(3) & wstrArray(4) & wstrArray(5) & wstrArray(10) & " " & _
                      wstrArray(11) & wstrArray(12) & " " & _
                      wstrArray(13) & wstrArray(14) & wstrArray(15) & _
                      wstrArray(16) & wstrArray(17) & wstrArray(18) & wstrArray(19) & wstrArray(20) & _
                      wstrArray(21) & wstrArray(22) & wstrArray(23) & wstrArray(24) & wstrArray(25) & _
                      wstrArray(26) & wstrArray(27) & wstrArray(28) & wstrArray(29) & wstrArray(30)
        End If

        Return wstrChg
    End Function

    '*******************************************************************************
    '* ‹@”\     : •\Ž¦—pº°ÄÞ‚ð’Êíº°ÄÞ‚É•ÏŠ·‚µ‚Ü‚·
    '* ˆø”     : pstrCode       String  •ÏŠ·Œ³º°ÄÞ
    '           :
    '* –ß‚è’l   : •ÏŠ·Œã•\Ž¦—p•¶Žš—ñ String
    '* ”õl     : ‚È‚µ
    '*******************************************************************************
    Public Function fBackDispItem(ByVal pstrCode As String, Optional ByVal pbolNoSep As Boolean = False) As String
        Dim wstrChg As String
        Dim wstrArray(34) As String
        Dim wintCnt As Integer
        Dim i As Integer

        wstrChg = ""

        '// ”z—ñ‚É¾¯Ä
        For i = 1 To 34
            wstrArray(i) = Mid(pstrCode, i, 1)
            If wstrArray(i) = "-" Then wintCnt = wintCnt + 1
        Next

        'ƒR[ƒh•ÏŠ·
        If wintCnt = 1 Then
            wstrChg = wstrArray(1) & wstrArray(2) & wstrArray(3) & wstrArray(4) & wstrArray(5) & _
                      wstrArray(7) & wstrArray(8) & wstrArray(9) & wstrArray(10) & wstrArray(11) & _
                      wstrArray(12) & wstrArray(13) & wstrArray(14) & wstrArray(15) & wstrArray(16) & _
                      wstrArray(17) & wstrArray(18) & wstrArray(19) & wstrArray(20) & wstrArray(21) & _
                      wstrArray(22) & wstrArray(23) & wstrArray(24) & wstrArray(25) & wstrArray(26) & _
                      wstrArray(27) & wstrArray(28) & wstrArray(29) & wstrArray(30) & wstrArray(31)
        ElseIf wintCnt = 2 Then
            wstrChg = wstrArray(6) & wstrArray(7) & wstrArray(9) & wstrArray(10) & wstrArray(11) & _
                      wstrArray(1) & wstrArray(2) & wstrArray(3) & wstrArray(4) & wstrArray(12) & _
                      wstrArray(14) & wstrArray(15) & wstrArray(17) & wstrArray(18) & wstrArray(19) & _
                      wstrArray(20) & wstrArray(21) & wstrArray(22) & wstrArray(23) & wstrArray(24) & _
                      wstrArray(25) & wstrArray(26) & wstrArray(27) & wstrArray(28) & wstrArray(29) & _
                      wstrArray(30) & wstrArray(31) & wstrArray(32) & wstrArray(33) & wstrArray(34)
        Else
            If pbolNoSep Then
                If wstrArray(1) = "9" Then
                    wstrChg = wstrArray(1) & wstrArray(2) & wstrArray(3) & wstrArray(4) & wstrArray(5) & _
                              wstrArray(6) & wstrArray(7) & wstrArray(8) & wstrArray(9) & wstrArray(10) & _
                              wstrArray(11) & wstrArray(12) & wstrArray(13) & wstrArray(14) & wstrArray(15) & _
                              wstrArray(16) & wstrArray(17) & wstrArray(18) & wstrArray(19) & wstrArray(20) & _
                              wstrArray(21) & wstrArray(22) & wstrArray(23) & wstrArray(24) & wstrArray(25) & _
                              wstrArray(26) & wstrArray(27) & wstrArray(28) & wstrArray(29) & wstrArray(30)
                Else
                    wstrChg = wstrArray(5) & wstrArray(6) & wstrArray(7) & wstrArray(8) & wstrArray(9) & _
                              wstrArray(1) & wstrArray(2) & wstrArray(3) & wstrArray(4) & wstrArray(10) & _
                              wstrArray(11) & wstrArray(12) & wstrArray(13) & wstrArray(14) & wstrArray(15) & _
                              wstrArray(16) & wstrArray(17) & wstrArray(18) & wstrArray(19) & wstrArray(20) & _
                              wstrArray(21) & wstrArray(22) & wstrArray(23) & wstrArray(24) & wstrArray(25) & _
                              wstrArray(26) & wstrArray(27) & wstrArray(28) & wstrArray(29) & wstrArray(30)
                End If
            Else
                wstrChg = pstrCode
            End If
        End If

        fBackDispItem = wstrChg

        Return wstrChg
    End Function

    '*******************************************************************************
    '   ŠT—vFo‰×À²Ìß‚Ì’l‚ðTBL‚æ‚èŽæ“¾‚µ‰Šú’l‚Æ‚µ‚ÄComboBox‚ÉÝ’è‚³‚¹‚éˆ—
    '   Êß×Ò°ÀFobj ºÝÎÞÎÞ¯¸½µÌÞ¼Þª¸Ä
    '   –ß‚è’lF‚È‚µ
    '*******************************************************************************
    Public Sub sGetPicsType(ByVal obj As System.Object)
        Dim strText As String

        '‘ÎÛÃ°ÌÞÙŒŸõ(o‰×À²Ìß)
        'If gclsDB.fOpenRecord("PICSTYPE", "PICSTYPEKEY00", "TBL1") = -1 Then
        '    'DBÚ‘±ƒGƒ‰[‚Ìê‡iŠJ”­—pj
        '    MsgBox("DB Error.")
        '    Exit Sub
        'End If

        '‘ÎÛÚº°ÄÞŒŸõ
        'With gclsDB.Records("TBL1")
        '    Do
        '        If .Item("Permit") = "1" Then         'Žg—p‰Â‚Ì‚à‚Ì‚Ì‚Ý‘ÎÛ‚Æ‚·‚é
        '            DirectCast(obj, ComboBox).Items.Add(.Item("PicsType"))  'o‰×À²Ìß
        '        End If
        '        'ŽŸƒŒƒR[ƒh‚ðŽæ“¾‚·‚é
        '        If .Read(BtLib.Operation.GetNext) <> 0 Then
        '            'ƒŒƒR[ƒh‚ª‚È‚­‚È‚ê‚ÎI—¹‚·‚é
        '            Exit Do
        '        End If
        '    Loop
        '    gclsDB.fCloseRecord("TBL1")
        'End With

    End Sub

    '*******************************************************************************
    '   ŠT—vF¶½ÀÏ°À²Ìß‚Ì¶½ÀÏ°ID‚ðTBL‚æ‚èŽæ“¾‚µ‰Šú’l‚Æ‚µ‚ÄComboBox‚ÉÝ’è‚³‚¹‚éˆ—
    '   Êß×Ò°ÀFobj ºÝÎÞÎÞ¯¸½µÌÞ¼Þª¸Ä
    '   –ß‚è’lF‚È‚µ
    '*******************************************************************************
    Public Sub sGetCustType(ByVal obj As System.Object, Optional ByVal pstrPicsType As String = "")
        Dim strText As String
        Dim wbulF As Boolean

        '‘ÎÛÃ°ÌÞÙŒŸõ(o‰×À²Ìß)
        'If gclsDB.fOpenRecord(G_CONST_TBL_CUSTTYPE, G_CONST_KEY_CUSTTYPEKEY00, "TBL1") = -1 Then
        '    'DBÚ‘±ƒGƒ‰[‚Ìê‡iŠJ”­—pj
        '    MsgBox("DB Error.")
        '    Exit Sub
        'End If

        '‘ÎÛÚº°ÄÞŒŸõ
        'With gclsDB.Records("TBL1")
        '    Do
        '        wbulF = True
        '        If pstrPicsType <> "" Then
        '            If .Item("PicsType") <> pstrPicsType Then
        '                wbulF = False
        '            End If
        '        End If

        '        If wbulF Then
        '            DirectCast(obj, ComboBox).Items.Add(.Item("CstmId"))  'o‰×À²Ìß
        '        End If

        '        If .Read(BtLib.Operation.GetNext) <> 0 Then
        '            'ƒŒƒR[ƒh‚ª‚È‚­‚È‚ê‚ÎI—¹‚·‚é
        '            Exit Do
        '        End If
        '    Loop
        '    gclsDB.fCloseRecord("TBL1")
        'End With

    End Sub

    '*******************************************************************************
    '   ŠT—vF•”•iŒÉ‚Ì’l‚ðTBL‚æ‚èŽæ“¾‚µ‰Šú’l‚Æ‚µ‚ÄComboBox‚ÉÝ’è‚³‚¹‚éˆ—
    '   Êß×Ò°ÀFobj ºÝÎÞÎÞ¯¸½µÌÞ¼Þª¸Ä
    '   –ß‚è’lF‚È‚µ
    '*******************************************************************************
    Public Sub sGetBhk(ByVal obj As System.Object)
        Dim strText As String

        '‘ÎÛÃ°ÌÞÙŒŸõ(•”•iŒÉ)
        'If gclsDB.fOpenRecord("RL2RL", "RL2RLKEY00", "TBL1") = -1 Then
        '    'DBÚ‘±ƒGƒ‰[‚Ìê‡iŠJ”­—pj
        '    MsgBox("DB Error.")
        '    Exit Sub
        'End If

        '‘ÎÛÚº°ÄÞŒŸõ
        'With gclsDB.Records("TBL1")
        '    Do
        '        DirectCast(obj, ComboBox).Items.Add(.Item("ChgBhk"))  '•”•iŒÉ

        '        'ŽŸƒŒƒR[ƒh‚ðŽæ“¾‚·‚é
        '        If .Read(BtLib.Operation.GetNext) <> 0 Then
        '            'ƒŒƒR[ƒh‚ª‚È‚­‚È‚ê‚ÎI—¹‚·‚é
        '            Exit Do
        '        End If
        '    Loop
        '    gclsDB.fCloseRecord("TBL1")
        'End With

    End Sub

    '*******************************************************************************
    '   ŠT—vFSpread‚Ìs‘I‘ð‚ðs‚¤
    '   Êß×Ò°ÀFpobjSpread  SpreadµÌÞ¼Þª¸Ä
    '         FpintRow     ‘I‘ðs
    '   –ß‚è’lF‚È‚µ
    '*******************************************************************************
    'Public Sub sCellColorChg(ByVal pobjSpread As Object, ByVal pintRow As Long)
    '    Dim i As Integer
    '    Dim j As Integer

    '    With pobjSpread.ActiveSheet
    '        For i = 0 To .RowCount - 1
    '            For j = 0 To .ColumnCount - 1
    '                .Cells(i, j).BackColor = Color.White
    '                .Cells(i, j).ForeColor = Color.Black
    '            Next j
    '        Next i
    '        For j = 0 To .ColumnCount - 1
    '            .Cells(pintRow, j).BackColor = Color.Navy
    '            .Cells(pintRow, j).ForeColor = Color.White
    '        Next j
    '    End With

    'End Sub

    '*******************************************************************************
    '   ŠT—v  F¬”“_•t”’l•¶Žš—ñ‚ðDB“o˜^—p•¶Žš—ñ‚É•ÒW‚µ•Ô‹p‚·‚é
    '   Êß×Ò°ÀFpstrDbl     ¬”“_•t”’l•¶Žš—ñ
    '         FpintPadCnt  ¾ÞÛ–„Œ…”
    '   –ß‚è’lFDB“o˜^—p•¶Žš—ñ ( 99.99 Ë 00999900 )
    '*******************************************************************************
    Public Function fDblToDBString(ByVal pstrDbl As String, ByVal pintPadCnt As Integer) As String
        Dim wstrValue As String

        wstrValue = pstrDbl.Replace(".", "").PadLeft(pintPadCnt, "0")
        fDblToDBString = wstrValue

    End Function

    '*******************************************************************************
    '   ŠT—v  FDB“o˜^—p•¶Žš—ñ‚ð¬”“_•t”’l•¶Žš—ñ‚É•ÒW‚µ•Ô‹p‚·‚é
    '   Êß×Ò°ÀFpstrDbl     DB“o˜^—p•¶Žš—ñ
    '         FpintIntCnt  ®”•”Œ…”
    '         FpintDecCnt  ¬”•”Œ…”
    '   –ß‚è’lFDB“o˜^—p•¶Žš—ñ ( 00999900Ë 99.99 )
    '*******************************************************************************
    Public Function fDBStringToDbl(ByVal pstrDbl As String, ByVal pintIntCnt As Integer, ByVal pintDecCnt As Integer) As String
        Dim wstrValue As String

        wstrValue = Microsoft.VisualBasic.Left(pstrDbl, pintIntCnt) & "." & Microsoft.VisualBasic.Right(pstrDbl, pintDecCnt)
        fDBStringToDbl = fCheckDblZeroSuplessS(wstrValue, pintIntCnt + pintDecCnt + 1, pintDecCnt + 1)

    End Function

    '*******************************************************************************
    '   ŠT—v  F¾ÞÛ–„‚ß”’l•¶Žš—ñ‚ð‰æ–Ê•\Ž¦—p•¶Žš—ñ‚É•ÒW‚µ•Ô‹p‚·‚é
    '   Êß×Ò°ÀFpstrData    ¾ÞÛ–„”’l•¶Žš—ñ
    '         FpintPadCnt  ¾ÞÛ–„Œ…”
    '   –ß‚è’lFDB“o˜^—p•¶Žš—ñ ( 00999 Ë 999 )
    '*******************************************************************************
    Public Function fIntZerosapress(ByVal pstrData As String) As String
        Dim wstrValue As String
        Dim wlngData As Long

        wlngData = CLng(pstrData)
        wstrValue = wlngData.ToString("#0")
        fIntZerosapress = wstrValue

    End Function

    '*******************************************************************************
    '   ŠT—v  F·°“ü—Í’l‚Ì§ŒÀ‚ðs‚¤
    '   Êß×Ò°ÀFpstrChr     “ü—Í•¶Žš
    '         FpintMode    §ŒÀ(KEY)
    '   –ß‚è’lFTrue ‹K’èŠO  
    '*******************************************************************************
    Public Function sKeyPress(ByVal pstrChr As Char, ByVal pintMode As KEY) As Boolean
        sKeyPress = False
        Select Case pintMode
            Case KEY.Number
                If (pstrChr < "0"c Or pstrChr > "9"c) And _
                    pstrChr <> vbBack Then
                    sKeyPress = True
                End If
            Case KEY.Alpha
                If (pstrChr < "a"c Or pstrChr > "z"c) And _
                   (pstrChr < "A"c Or pstrChr > "Z"c) And _
                    pstrChr <> vbBack Then
                    sKeyPress = True
                End If
            Case KEY.NumAlpha
                If (pstrChr < "0"c Or pstrChr > "9"c) And _
                   (pstrChr < "a"c Or pstrChr > "z"c) And _
                   (pstrChr < "A"c Or pstrChr > "Z"c) And _
                    pstrChr <> vbBack Then
                    sKeyPress = True
                End If
            Case KEY.TelPost
                If (pstrChr < "0"c Or pstrChr > "9"c) And _
                    pstrChr <> vbBack And pstrChr <> "-"c Then
                    sKeyPress = True
                End If
            Case KEY.NumberDec
                If (pstrChr < "0"c Or pstrChr > "9"c) And _
                    pstrChr <> vbBack And pstrChr <> "."c Then
                    sKeyPress = True
                End If
            Case KEY.DateShift
                If (pstrChr < "0"c Or pstrChr > "9"c) And _
                    pstrChr <> "d"c And pstrChr <> "n"c And _
                    pstrChr <> "D"c And pstrChr <> "N"c And _
                    pstrChr <> vbBack Then
                    sKeyPress = True
                End If
        End Select
    End Function

    '*******************************************************************************
    '   ŠT—v  FÌ§²ÙÊß½‚ð¶¬‚·‚é
    '   Êß×Ò°ÀFpstrDir     ÃÞ¨Ú¸ÄØ
    '         FpstrFile    Ì§²Ù–¼
    '   –ß‚è’lFÊß½
    '*******************************************************************************
    Public Function fMakeFilePath(ByVal pstrDir As String, ByVal pstrFile As String) As String
        Dim wstrPath As String

        wstrPath = pstrDir
        If Microsoft.VisualBasic.Right(wstrPath, 1) <> "" Then wstrPath &= "\"
        Return wstrPath & pstrFile

    End Function

    '*******************************************************************************
    '   ŠT—vF•”•iŒÉ‚Ì’l‚ðTBL‚æ‚èŽæ“¾‚µ‰Šú’l‚Æ‚µ‚ÄComboBox‚ÉÝ’è‚³‚¹‚éˆ—
    '   Êß×Ò°ÀFobj ºÝÎÞÎÞ¯¸½µÌÞ¼Þª¸Ä
    '   –ß‚è’lF‚È‚µ
    '*******************************************************************************
    Public Sub sGetCenterCode(ByVal obj As System.Object)
        Dim strText As String

        '‘ÎÛÃ°ÌÞÙŒŸõ(¾ÝÀ°º°ÄÞ)
        'If gclsDB.fOpenRecord("CENTER", "CENTERKEY00", "TBL1") = -1 Then
        '    'DBÚ‘±ƒGƒ‰[‚Ìê‡iŠJ”­—pj
        '    MsgBox("DB Error.")
        '    Exit Sub
        'End If
        '‘ÎÛÚº°ÄÞŒŸõ
        'With gclsDB.Records("TBL1")
        '    Do
        '        DirectCast(obj, ComboBox).Items.Add(.Item("CenterCode"))  '•”•iŒÉ

        '        'ŽŸƒŒƒR[ƒh‚ðŽæ“¾‚·‚é
        '        If .Read(BtLib.Operation.GetNext) <> 0 Then
        '            'ƒŒƒR[ƒh‚ª‚È‚­‚È‚ê‚ÎI—¹‚·‚é
        '            Exit Do
        '        End If
        '    Loop
        '    gclsDB.fCloseRecord("TBL1")
        'End With


    End Sub

    '*******************************************************************************
    '   ŠT—vFLN2RL‚ð“Ç‚ÝAÒÓØ‚É“WŠJ‚·‚é
    '   Êß×Ò°ÀFpstrctLN2RL LN2RL\‘¢‘Ì
    '   –ß‚è’lFTrue/False
    '*******************************************************************************
    'Public Function fLN2RL_Set(ByRef pstrctLN2RL() As LN2RL_STR) As Boolean
    '    Dim wstrSql As String
    '    Dim wlngCnt As Long
    '    Dim i As Long
    '    Const Key1 = "LN2RL"

    '    fLN2RL_Set = False
    '    Try
    '        wlngCnt = gclsDB.fOpenRecord(G_CONST_TBL_PRESETBHK, G_CONST_KEY_PRESETBHKKEY00, Key1)
    '        If wlngCnt = -1 Then
    '            'DBÚ‘±ƒGƒ‰[‚Ìê‡
    '            Exit Function
    '        End If

    '        If wlngCnt = 0 Then
    '            i = 0
    '            Do
    '                ReDim Preserve pstrctLN2RL(i)
    '                pstrctLN2RL(i).PackLine = gclsDB.Records(Key1).Item("PackLine")
    '                pstrctLN2RL(i).PreBhk = gclsDB.Records(Key1).Item("PreBhk")
    '                If gclsDB.Records(Key1).Read(BtLib.Operation.GetNext) = 9 Then
    '                    Exit Do
    '                End If
    '                i += 1
    '            Loop
    '            fLN2RL_Set = True
    '        End If
    '        gclsDB.fCloseRecord(Key1)

    '    Catch ex As Exception
    '        sErrLog(gAppName, "fLN2RL_Set", ex.Message)

    '    End Try

    'End Function

    '*******************************************************************************
    '   ŠT—vFÒÓØã‚ÌLR2RN‚©‚çŠY“–ÃÞ°À‚ðŽæ“¾‚·‚é
    '   Êß×Ò°ÀFpstrPackLine ŒŸõ’l
    '         FpstrctLN2RL  LN2RL\‘¢‘Ì
    '   –ß‚è’lFŒŸõŒ‹‰Ê@ŠY“––³‚µ‚Ìê‡‚Í‹ó”’
    '*******************************************************************************
    Public Function fLN2RL_Serch(ByVal pstrPackLine As String, ByVal pstrctLN2RL() As LN2RL_STR, ByRef pintIndex As Integer) As String
        Dim wstrSql As String
        Dim wlngCnt As Long
        Dim i As Long

        fLN2RL_Serch = ""
        Try
            For i = 0 To UBound(pstrctLN2RL)
                If pstrctLN2RL(i).PackLine = pstrPackLine Then
                    pintIndex = i
                    fLN2RL_Serch = pstrctLN2RL(i).PreBhk
                    Exit Function
                End If
            Next

        Catch ex As Exception
            sErrLog(gAppName, "fLN2RL_Serch", ex.Message)

        End Try

    End Function

    '*******************************************************************************
    '   ŠT—vFRN2RL‚ð“Ç‚ÝAÒÓØ‚É“WŠJ‚·‚é
    '   Êß×Ò°ÀFpstrctRN2RL RN2RL\‘¢‘Ì
    '   –ß‚è’lFTrue/False
    '*******************************************************************************
    'Public Function fRL2RL_Set(ByRef pstrctRL2RL() As RL2RL_STR) As Boolean
    '    Dim wstrSql As String
    '    Dim wlngCnt As Long
    '    Dim i As Long
    '    Const Key1 = "RL2RL"

    '    fRL2RL_Set = False
    '    Try
    '        wlngCnt = gclsDB.fOpenRecord(G_CONST_TBL_RL2RL, G_CONST_KEY_RL2RLKEY00, Key1)
    '        If wlngCnt = -1 Then
    '            'DBÚ‘±ƒGƒ‰[‚Ìê‡
    '            Exit Function
    '        End If

    '        If wlngCnt = 0 Then
    '            i = 0
    '            Do
    '                ReDim Preserve pstrctRL2RL(i)
    '                pstrctRL2RL(i).Bhk = gclsDB.Records(Key1).Item("Bhk")
    '                pstrctRL2RL(i).ChgBhk = gclsDB.Records(Key1).Item("ChgBhk")
    '                pstrctRL2RL(i).CenterCode = gclsDB.Records(Key1).Item("CenterCode")
    '                If gclsDB.Records(Key1).Read(BtLib.Operation.GetNext) = 9 Then
    '                    Exit Do
    '                End If
    '                i += 1
    '            Loop
    '            fRL2RL_Set = True
    '        End If
    '        gclsDB.fCloseRecord(Key1)

    '    Catch ex As Exception
    '        sErrLog(gAppName, "fRL2RL_Set", ex.Message)

    '    End Try

    'End Function

    '*******************************************************************************
    '   ŠT—vFÒÓØã‚ÌRL2RL‚©‚çŠY“–ÃÞ°À‚ðŽæ“¾‚·‚é
    '   Êß×Ò°ÀFpstrBhk      ŒŸõ’l
    '         FpstrctRL2RL  RL2RL\‘¢‘Ì
    '   –ß‚è’lFŒŸõŒ‹‰Ê@ŠY“––³‚µ‚Ìê‡‚Í‹ó”’
    '*******************************************************************************
    Public Function fRL2RL_Serch(ByVal pstrBhk As String, ByVal pstrctRL2RL() As RL2RL_STR, ByRef pintIndex As Integer) As String
        Dim wstrSql As String
        Dim wlngCnt As Long
        Dim i As Long

        fRL2RL_Serch = ""
        Try
            For i = 0 To UBound(pstrctRL2RL)
                If pstrctRL2RL(i).Bhk = pstrBhk Then
                    pintIndex = i
                    fRL2RL_Serch = pstrctRL2RL(i).ChgBhk
                    Exit Function
                End If
            Next

        Catch ex As Exception
            sErrLog(gAppName, "fRL2RL_Serch", ex.Message)

        End Try

    End Function

    '*******************************************************************************
    '   ŠT—vFLN2LN‚ð“Ç‚ÝAÒÓØ‚É“WŠJ‚·‚é
    '   Êß×Ò°ÀFpstrctRN2RL RN2RL\‘¢‘Ì
    '   –ß‚è’lFTrue/False
    '*******************************************************************************
    'Public Function fLN2LN_Set(ByRef pstrctLN2LN() As LN2LN_STR) As Boolean
    '    Dim wstrSql As String
    '    Dim wlngCnt As Long
    '    Dim i As Long
    '    Const Key1 = "LN2LN"

    '    fLN2LN_Set = False
    '    Try
    '        wlngCnt = gclsDB.fOpenRecord(G_CONST_TBL_LN2LN, G_CONST_KEY_LN2LNKEY00, Key1)
    '        If wlngCnt = -1 Then
    '            'DBÚ‘±ƒGƒ‰[‚Ìê‡
    '            Exit Function
    '        End If

    '        If wlngCnt = 0 Then
    '            i = 0
    '            Do
    '                ReDim Preserve pstrctLN2LN(i)
    '                pstrctLN2LN(i).PackLine = gclsDB.Records(Key1).Item("PackLine")
    '                pstrctLN2LN(i).ChgPackLine = gclsDB.Records(Key1).Item("ChgPackLine")
    '                pstrctLN2LN(i).CenterCode = gclsDB.Records(Key1).Item("CenterCode")
    '                pstrctLN2LN(i).CalFlag = gclsDB.Records(Key1).Item("CalFlag")
    '                If gclsDB.Records(Key1).Read(BtLib.Operation.GetNext) = 9 Then
    '                    Exit Do
    '                End If
    '                i += 1
    '            Loop
    '            fLN2LN_Set = True
    '        End If
    '        gclsDB.fCloseRecord(Key1)

    '    Catch ex As Exception
    '        sErrLog(gAppName, "fLN2LN_Set", ex.Message)

    '    End Try

    'End Function

    '*******************************************************************************
    '   ŠT—vFÒÓØã‚ÌLN2LN‚©‚çŠY“–ÃÞ°À‚ðŽæ“¾‚·‚é
    '   Êß×Ò°ÀFpstrBhk      ŒŸõ’l
    '         FpstrctLN2LN  LN2LN\‘¢‘Ì
    '   –ß‚è’lFŒŸõŒ‹‰Ê@ŠY“––³‚µ‚Ìê‡‚Í‹ó”’
    '*******************************************************************************
    Public Function fLN2LN_Serch(ByVal pstrPackLine As String, ByVal pstrctLN2LN() As LN2LN_STR, ByRef pintIndex As Integer) As String
        Dim wstrSql As String
        Dim wlngCnt As Long
        Dim i As Long

        fLN2LN_Serch = ""
        Try
            For i = 0 To UBound(pstrctLN2LN)
                If pstrctLN2LN(i).PackLine = pstrPackLine Then
                    pintIndex = i
                    fLN2LN_Serch = pstrctLN2LN(i).ChgPackLine
                    Exit Function
                End If
            Next

        Catch ex As Exception
            sErrLog(gAppName, "fLN2LN_Serch", ex.Message)

        End Try

    End Function

    '*******************************************************************************
    '   ŠT—vFIDCNV‚ð“Ç‚ÝAÒÓØ‚É“WŠJ‚·‚é
    '   Êß×Ò°ÀFpstrctIDCNV  IDCNV\‘¢‘Ì
    '   –ß‚è’lFTrue/False
    '*******************************************************************************
    'Public Function fIDCNV_Set(ByRef pstrctIDCNV() As IDCNV_STR) As Boolean
    '    Dim wstrSql As String
    '    Dim wlngCnt As Long
    '    Dim i As Long
    '    Const Key1 = "IDCNV"

    '    fIDCNV_Set = False
    '    Try
    '        wlngCnt = gclsDB.fOpenRecord(G_CONST_TBL_IDCNV, G_CONST_KEY_IDCNVKEY00, Key1)
    '        If wlngCnt = -1 Then
    '            'DBÚ‘±ƒGƒ‰[‚Ìê‡
    '            Exit Function
    '        End If

    '        If wlngCnt = 0 Then
    '            i = 0
    '            Do
    '                ReDim Preserve pstrctIDCNV(i)
    '                pstrctIDCNV(i).Code = gclsDB.Records(Key1).Item("Code")
    '                pstrctIDCNV(i).Znc = gclsDB.Records(Key1).Item("Znc")
    '                If gclsDB.Records(Key1).Read(BtLib.Operation.GetNext) = 9 Then
    '                    Exit Do
    '                End If
    '                i += 1
    '            Loop
    '            fIDCNV_Set = True
    '        End If
    '        gclsDB.fCloseRecord(Key1)

    '    Catch ex As Exception
    '        sErrLog(gAppName, "fIDCNV_Set", ex.Message)

    '    End Try

    'End Function

    '*******************************************************************************
    '   ŠT—vFÒÓØã‚ÌIDCNV‚©‚çŠY“–ÃÞ°À‚ðŽæ“¾‚·‚é
    '   Êß×Ò°ÀFpstrCode     ŒŸõ’l
    '         FpstrctIDCNV  IDCNV\‘¢‘Ì
    '   –ß‚è’lFŒŸõŒ‹‰Ê@ŠY“––³‚µ‚Ìê‡‚Í‹ó”’
    '*******************************************************************************
    Public Function fIDCNV_Serch(ByVal pstrCode As String, ByVal pstrctIDCNV() As IDCNV_STR, ByRef pintIndex As Integer) As String
        Dim wstrSql As String
        Dim wlngCnt As Long
        Dim i As Long

        fIDCNV_Serch = ""
        Try
            For i = 0 To UBound(pstrctIDCNV)
                If pstrctIDCNV(i).Code = pstrCode Then
                    fIDCNV_Serch = pstrctIDCNV(i).Znc
                    Exit Function
                End If
            Next

        Catch ex As Exception
            sErrLog(gAppName, "fIDCNV_Serch", ex.Message)

        End Try

    End Function

    '*******************************************************************************
    '   ŠT—v  FÌßØÌ¨¯¸½A»Ì¨¯¸½AÁª¯¸ÃÞ¼Þ¯Ä‚ð•t‰Á‚µ‚½•¶Žš—ñ‚ð•Ô‚·
    '   Êß×Ò°ÀFpstrCode    String      ƒo[ƒR[ƒh
    '   –ß‚è’lFÌßØÌ¨¯¸½A»Ì¨¯¸½AÁª¯¸ÃÞ¼Þ¯Ä‚ð•t‰Á‚µ‚½•¶Žš—ñ
    '*******************************************************************************
    Public Function fConvBarcode(ByVal pstrCode As String) As String
        Const c_MOJ43 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*"    'Ó¼Þ­×½43
        Dim wlngAll As Long
        Dim wlngBar As Long
        Dim wlngMoju43 As Long
        Dim wstrMojuCd As String

        fConvBarcode = pstrCode
        wlngAll = 0

        'ÌßØÌ¨¯¸½Áª¯¸
        If Mid(pstrCode, 1, 1) = "*" Then Exit Function

        'Áª¯¸ÃÞ¼Þ¯ÄŒvŽZ
        For wlngBar = 1 To Len(pstrCode)
            For wlngMoju43 = 1 To 43
                If Mid(pstrCode, wlngBar, 1) = Mid(c_MOJ43, wlngMoju43, 1) Then
                    'ˆê’v‚·‚ê‚ÎŽŸ‚Ì•¶Žš‚Ö
                    wlngAll = wlngAll + wlngMoju43 - 1
                    Exit For
                End If
            Next wlngMoju43
        Next wlngBar

        wlngAll = wlngAll Mod 43
        wstrMojuCd = "*" & pstrCode & Mid(c_MOJ43, wlngAll + 1, 1) & "*"
        'ÊÞ°º°ÄÞ
        fConvBarcode = wstrMojuCd

    End Function

    '*******************************************************************************
    ' ŠT—v      : ƒtƒ@ƒCƒ‹ƒI[ƒvƒ“ƒ`ƒFƒbƒN
    ' ˆø”      : pintOpen  Integer    (0:Append / 1:Binary / 2:Input / 3:Output / 4:Random)
    '           : pstrPath  String     Ì§²ÙÊß½
    ' –ß‚è’l    : Boolean@True:µ°ÌßÝ¬Œ÷ False:µ°ÌßÝŽ¸”s
    ' ”õl      : 
    '*******************************************************************************
    Public Function fCheckOpenFile(ByVal pintOpen As Integer, ByVal pstrPath As String) As Boolean
        'Dim wintFileNum As Integer

        'fCheckOpenFile = False

        'Try
        '    wintFileNum = FreeFile() ' ƒtƒŠ[‚Ìƒtƒ@ƒCƒ‹ƒiƒ“ƒo[‚ðŽæ“¾

        '    ' o—Íƒtƒ@ƒCƒ‹‚ÌƒI[ƒvƒ“
        '    Select Case pintOpen
        '        Case 0
        '            FileOpen(wintFileNum, pstrPath, OpenMode.Append)
        '        Case 1
        '            FileOpen(wintFileNum, pstrPath, OpenMode.Binary)
        '        Case 2
        '            FileOpen(wintFileNum, pstrPath, OpenMode.Input)
        '        Case 3
        '            FileOpen(wintFileNum, pstrPath, OpenMode.Output)
        '        Case 4
        '            FileOpen(wintFileNum, pstrPath, OpenMode.Random)
        '    End Select

        '    FileClose(wintFileNum) ' o—Íƒtƒ@ƒCƒ‹‚ÌƒNƒ[ƒY

        '    fCheckOpenFile = True
        '    Exit Function

        'Catch ex As Exception
        '    sErrLog(gAppName, "fCheckOpenFile", ex.ToString)
        'End Try

        Try
            ' Create a FileStream to attempt to open the file
            Using fs As New FileStream(pstrPath, FileMode.OpenOrCreate, FileAccess.ReadWrite)
                ' Check if the file can be opened based on the open mode specified
                Select Case pintOpen
                    Case 0 ' OpenMode.Append
                        ' Move the stream position to the end of the file
                        fs.Seek(0, SeekOrigin.End)
                    Case 1 ' OpenMode.Binary
                        ' No specific action needed for Binary mode
                    Case 2 ' OpenMode.Input
                        ' No specific action needed for Input mode
                    Case 3 ' OpenMode.Output
                        ' No specific action needed for Output mode
                    Case 4 ' OpenMode.Random
                        ' No specific action needed for Random mode
                End Select
            End Using

            ' If no exception is thrown, the file can be opened
            Return True
        Catch ex As Exception
            ' An exception occurred while attempting to open the file
            ' Log the error or handle it as required
            Return False
        End Try
    End Function

    '*******************************************************************************
    '   ‹@”\@F1Œ…‚Ì”N‚ð4Œ…‚É•ÏŠ·‚·‚é
    '   –ß‚è’lFString      ’ZkŒ^•¶Žš—ñ
    '   ˆø”  FpstrY     String      ”N‰º1Œ… (y)
    '         FpstrDate  String      •ÏŠ·”N  (yyyy)
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    'Public Function fIoYyyyCtl(ByVal pstrY As String, ByRef pstrDate As String) As Boolean

    '    Dim wstrFileName As String
    '    Dim wintFileNum As Integer
    '    Dim strGetY As String
    '    Dim strYear As String

    '    fIoYyyyCtl = False
    '    Try

    '        'ƒtƒ@ƒCƒ‹ƒI[ƒvƒ“
    '        wintFileNum = FreeFile()
    '        wstrFileName = fMakeFilePath(fgetAppPath(), G_CONST_YYYY_CTL)
    '        FileOpen(wintFileNum, wstrFileName, OpenMode.Input)

    '        'YYYY.CTL‚©‚çŽæ“¾
    '        Input(wintFileNum, strGetY)
    '        'o—Íƒtƒ@ƒCƒ‹‚ÌƒNƒ[ƒY
    '        FileClose(wintFileNum)

    '        strGetY = strGetY.PadRight(4, " ")
    '        pstrY = pstrY.PadRight(1, " ")

    '        'YYYY.CTL‚Ì“ª‚RŒ…(XXX_) & ”N‰º1Œ…(X)
    '        strYear = strGetY.Substring(0, 3) & pstrY.Substring(0, 1)

    '        If strGetY = strYear Then
    '            'YYYY.CTL‚ª"2000", ”N‰º1Œ… = "0"‚Ìê‡
    '            strGetY = CStr(2000 + 10)
    '            strYear = strGetY

    '            'ƒtƒ@ƒCƒ‹o—Í
    '            wintFileNum = FreeFile()
    '            FileOpen(wintFileNum, wstrFileName, OpenMode.Output)
    '            Print(wintFileNum, strYear)
    '            'o—Íƒtƒ@ƒCƒ‹‚ÌƒNƒ[ƒY
    '            FileClose(wintFileNum)
    '        End If

    '        pstrDate = strYear
    '        fIoYyyyCtl = True
    '        Exit Function

    '    Catch ex As Exception
    '        sErrLog(gAppName, "fIoYyyyCtl", ex.ToString)
    '        FileClose(wintFileNum)                  ' o—Íƒtƒ@ƒCƒ‹‚ÌƒNƒ[ƒY
    '    End Try
    'End Function

    '*******************************************************************************
    '   ‹@”\@FYYYYMMDDŒ`Ž®‚Ì’ZkŒ^‚ð•Ô‚·
    '   –ß‚è’lFString      ’ZkŒ^•¶Žš—ñ
    '   ˆø”  FpstrNow     String      “ú•t(yyyyMMdd)
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    Public Function fYmdToShorten(ByVal pstrNow As String) As String
        Dim wstrYear As String
        Dim wstrTuki As String
        Dim wstrMonth As String
        Dim wstrDay As String

        wstrYear = Mid(pstrNow, 4, 1)   '”N‚Ì‰º1Œ…
        wstrTuki = Mid(pstrNow, 5, 2)   'ŒŽ2Œ…
        'ŠeŒŽ‚É‘Î‰ž‚·‚é•¶Žš
        Select Case wstrTuki
            Case "01"
                wstrMonth = "A"
            Case "02"
                wstrMonth = "B"
            Case "03"
                wstrMonth = "C"
            Case "04"
                wstrMonth = "D"
            Case "05"
                wstrMonth = "E"
            Case "06"
                wstrMonth = "F"
            Case "07"
                wstrMonth = "G"
            Case "08"
                wstrMonth = "H"
            Case "09"
                wstrMonth = "I"
            Case "10"
                wstrMonth = "J"
            Case "11"
                wstrMonth = "K"
            Case "12"
                wstrMonth = "L"
        End Select
        wstrDay = fDayToShorten(Mid(pstrNow, 7, 2))    '“ú2Œ…

        '”N‚Ì‰º1Œ… + ŠeŒŽ‚É‘Î‰ž‚·‚é•¶Žš + “ú2Œ…
        fYmdToShorten = wstrYear & wstrMonth & wstrDay

    End Function

    '*******************************************************************************
    '   ‹@”\@F’ZkŒ^“ú•t‚ðYYYYMMDDŒ`Ž®‚Å•Ô‚·
    '   –ß‚è’lFString      YYYYMMDD
    '   ˆø”  FpstrNow     String      “ú•t(’ZkŒ^)
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    'Public Function fShortenToYMD(ByVal pstrNow As String) As String
    '    Dim wstrYear, wstrY As String
    '    Dim wstrTuki As String
    '    Dim wstrMonth As String
    '    Dim wstrDay As String
    '    wstrY = Mid(pstrNow, 1, 1)

    '    fIoYyyyCtl(wstrY, wstrYear) '¼—ïYYYY

    '    wstrMonth = Mid(pstrNow, 2, 1)   'ŒŽ2Œ…
    '    'ŠeŒŽ‚É‘Î‰ž‚·‚é•¶Žš
    '    Select Case wstrMonth
    '        Case "A"
    '            wstrTuki = "01"
    '        Case "B"
    '            wstrTuki = "02"
    '        Case "C"
    '            wstrTuki = "03"
    '        Case "D"
    '            wstrTuki = "04"
    '        Case "E"
    '            wstrTuki = "05"
    '        Case "F"
    '            wstrTuki = "06"
    '        Case "G"
    '            wstrTuki = "07"
    '        Case "H"
    '            wstrTuki = "08"
    '        Case "I"
    '            wstrTuki = "09"
    '        Case "J"
    '            wstrTuki = "10"
    '        Case "K"
    '            wstrTuki = "11"
    '        Case "L"
    '            wstrTuki = "12"
    '    End Select
    '    wstrDay = fShortenToDay(Mid(pstrNow, 3, 1))    '“ú2Œ…

    '    '”N‚Ì‰º1Œ… + ŠeŒŽ‚É‘Î‰ž‚·‚é•¶Žš + “ú2Œ…
    '    fShortenToYMD = wstrYear & wstrTuki & wstrDay

    'End Function

    '*******************************************************************************
    '   ‹@”\@F“ú‚ð’ZkŒ^‚É•ÏŠ·‚·‚é
    '   –ß‚è’lFString      ’ZkŒ^•¶Žš—ñ
    '   ˆø”  FpstrDate    String    “ú
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    Public Function fDayToShorten(ByVal pstrDate As String) As String
        Dim wstrSDayArray() As String = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "A", _
                                         "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", _
                                         "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", _
                                         "V"}
        Dim wintDay As Integer

        fDayToShorten = ""

        If Not IsNumeric(pstrDate) Then Exit Function

        wintDay = CInt(pstrDate)
        If wintDay < 1 Or wintDay > 31 Then Exit Function

        fDayToShorten = wstrSDayArray(wintDay - 1)

    End Function

    '*******************************************************************************
    '   ‹@”\@F’ZkŒ^‚Ì“ú‚ð2Œ…‚Ì“ú‚É•ÏŠ·‚·‚é
    '   –ß‚è’lFString      2Œ…‚Ì•¶Žš—ñ
    '   ˆø”  FpstrDate    String    ’Zk“ú
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    Public Function fShortenToDay(ByVal pstrDate As String) As String
        Dim wintDayArray() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, _
                                         11, 12, 13, 14, 15, 16, 17, 18, 19, 20, _
                                         21, 22, 23, 24, 25, 26, 27, 28, 29, 30, _
                                         31}
        Dim wstrSDayArray() As String = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "A", _
                                         "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", _
                                         "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", _
                                         "V"}
        Dim i As Integer, wintIndex As Integer

        fShortenToDay = ""

        wintIndex = -1
        For i = 0 To wstrSDayArray.Length - 1
            If pstrDate = wstrSDayArray(i) Then
                wintIndex = i
                Exit For
            End If
        Next
        If wintIndex < 0 Then Exit Function

        fShortenToDay = Microsoft.VisualBasic.Format(wintDayArray(wintIndex), "00")

    End Function

    '*******************************************************************************
    '   ‹@”\@F•¶Žš‚ðŽw’è‰ñ”˜AŒ‹‚³‚¹‚é
    '   –ß‚è’lFString      ˜AŒ‹•¶Žš—ñ
    '   ˆø”  FpintRepeat    Integer    ˜AŒ‹‰ñ”
    '         FpstrMoji      String     ˜AŒ‹•¶Žš
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    Public Function fStrRepeat(ByVal pintRepeat As Integer, ByVal pstrMoji As String) As String
        Dim i As Integer
        Dim wstrLine As String

        fStrRepeat = ""
        wstrLine = ""

        If pintRepeat < 1 Then Exit Function

        'ŒJ‚è•Ô‚µ˜AŒ‹
        For i = 0 To pintRepeat - 1
            wstrLine &= pstrMoji
        Next

        fStrRepeat = wstrLine

    End Function

    '*******************************************************************************
    '   ŠT—vF“ü—Í‚³‚ê‚½ƒVƒtƒg‚Â‚«“ú•t‚Ìƒ`ƒFƒbƒN‚ðs‚¤
    '   Êß×Ò°ÀFobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckDateS(ByVal obj As System.Object) As Integer

        Dim wintRet As Integer
        fCheckDateS = -1
        wintRet = fCheckDateS(DirectCast(obj, TextBox).Text())
        If wintRet <> 0 Then
            DirectCast(obj, TextBox).Focus()
        End If

        fCheckDateS = wintRet
    End Function

    '*******************************************************************************
    '   ‹@”\@F“ü—Í‚³‚ê‚½ƒVƒtƒg‚Â‚«“ú•t‚Ìƒ`ƒFƒbƒN‚ðs‚¤
    '   –ß‚è’lFInteger       Integer    0:OK -1:NG
    '   ˆø”  FpstrDate      String     “ü—Í’l
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    Public Function fCheckDateS(ByVal pstrDate As String) As Integer
        Dim wstrText As String
        Dim wstrShift As String
        Dim wstrYear As String
        Dim wstrMonth As String
        Dim wstrDay As String
        Dim wstrDate As String
        Dim wintLength As Integer

        fCheckDateS = 0
        wstrText = ""
        Try
            wstrText = fcheckNullString(pstrDate)
            wintLength = wstrText.Length

            If (wintLength = 9 Or wintLength = 8) Then

                wstrYear = Mid(pstrDate, 1, 4)
                wstrMonth = Mid(pstrDate, 5, 2)
                wstrDay = Mid(pstrDate, 7, 2)
                wstrShift = Mid(pstrDate, 9, 1)
                wstrDate = wstrYear & "/" & wstrMonth & "/" & wstrDay

                If Not (IsDate(wstrDate)) Then
                    fCheckDateS = -1
                    Exit Function
                End If
                If wstrShift <> "D" And wstrShift <> "N" Then
                    fCheckDateS = -2
                    Exit Function
                End If
            Else
                fCheckDateS = -1
                Exit Function
            End If

            fCheckDateS = 0

        Catch ex As Exception
            Return False
        End Try
    End Function

    '*******************************************************************************
    '   ‹@”\@F“ü—Í‚³‚ê‚½“ú•t‚Ì‘ŠŠÖŠÖŒW‚ðƒ`ƒFƒbƒN‚·‚é
    '   –ß‚è’lFInteger       Integer    0:OK -1:NG
    '   ˆø”  FpstrFromDate  String     From Date
    '   @@  FpstrToDate    String     To Date
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    Public Function fCheckDateDiff(ByVal pstrFromDate As String, ByVal pstrToDate As String) As Integer

        fCheckDateDiff = 0
        If pstrFromDate.Trim <> "" And pstrToDate.Trim <> "" Then
            If pstrFromDate > pstrToDate Then
                fCheckDateDiff = -1
            End If
        End If

    End Function

    '*******************************************************************************
    '   ŠT—vF“ü—Í‚³‚ê‚½“ú•t‚Ìƒ`ƒFƒbƒN‚ðs‚¤(––”ö00‹–‰Â)
    '   Êß×Ò°ÀFobj ƒeƒLƒXƒgƒIƒuƒWƒFƒNƒg
    '   –ß‚è’lFBoolean@True:OK False:NG
    '*******************************************************************************
    Public Function fCheckDateZero(ByVal obj As System.Object) As Boolean

        fCheckDateZero = False
        If fCheckDateZero(DirectCast(obj, TextBox).Text()) Then
            fCheckDateZero = True
        Else
            DirectCast(obj, TextBox).Focus()
        End If
    End Function

    '*******************************************************************************
    '   ‹@”\@F“ü—Í‚³‚ê‚½“ú•t‚Ìƒ`ƒFƒbƒN‚ðs‚¤(––”ö00‹–‰Â)
    '   –ß‚è’lFInteger       Integer    0:OK -1:NG
    '   ˆø”  FpstrDate      String     “ü—Í’l
    '   ”õl@F‚È‚µ
    '*******************************************************************************
    Public Function fCheckDateZero(ByRef pstrDate As String) As Boolean

        fCheckDateZero = False

        If pstrDate.Trim <> "" Then
            If pstrDate.Length = 6 Then
                If Not fCheckDate(pstrDate, G_CONST_CHK_YEAR_MONTH) Then Exit Function
                pstrDate = pstrDate & "00"
            ElseIf pstrDate.Length = 8 Then
                If Microsoft.VisualBasic.Right(pstrDate, 2) = "00" Then
                    If Not fCheckDate(Microsoft.VisualBasic.Left(pstrDate, 6), G_CONST_CHK_YEAR_MONTH) Then Exit Function
                Else
                    If Not fCheckDate(pstrDate, G_CONST_CHK_YEAR_DATE) Then Exit Function
                End If
            Else
                If Not fCheckDate(pstrDate, G_CONST_CHK_YEAR_DATE) Then Exit Function
            End If
        Else
            Exit Function
        End If
        fCheckDateZero = True

    End Function

    '<StructLayout(LayoutKind.Sequential, Pack = 4)> _
    Public Structure MWA_STARTUP
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=17)> _
        Public term_dev As String

        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=17)> _
        Public proc_dev As String

        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=4097)> _
        Public proc_path As String
    End Structure

End Module

