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

📄 form1.vb

📁 三汇CTI示例程序源码
💻 VB
📖 第 1 页 / 共 5 页
字号:
        Me.label17.Location = New System.Drawing.Point(16, 96)
        Me.label17.Name = "label17"
        Me.label17.Size = New System.Drawing.Size(48, 23)
        Me.label17.TabIndex = 2
        Me.label17.Text = "Fax To"
        '
        'label16
        '
        Me.label16.Location = New System.Drawing.Point(16, 62)
        Me.label16.Name = "label16"
        Me.label16.Size = New System.Drawing.Size(56, 23)
        Me.label16.TabIndex = 1
        Me.label16.Text = "Fax From"
        '
        'label15
        '
        Me.label15.Location = New System.Drawing.Point(16, 24)
        Me.label15.Name = "label15"
        Me.label15.Size = New System.Drawing.Size(64, 23)
        Me.label15.TabIndex = 0
        Me.label15.Text = "Tif File"
        '
        'tabPage4
        '
        Me.tabPage4.Controls.Add(Me.button17)
        Me.tabPage4.Controls.Add(Me.button16)
        Me.tabPage4.Controls.Add(Me.button15)
        Me.tabPage4.Controls.Add(Me.m_txtPageNo)
        Me.tabPage4.Controls.Add(Me.m_txtHeight)
        Me.tabPage4.Controls.Add(Me.m_txtTargetFile1)
        Me.tabPage4.Controls.Add(Me.m_txtSourceFile)
        Me.tabPage4.Controls.Add(Me.label24)
        Me.tabPage4.Controls.Add(Me.label23)
        Me.tabPage4.Controls.Add(Me.label22)
        Me.tabPage4.Controls.Add(Me.label21)
        Me.tabPage4.Location = New System.Drawing.Point(4, 21)
        Me.tabPage4.Name = "tabPage4"
        Me.tabPage4.Size = New System.Drawing.Size(352, 303)
        Me.tabPage4.TabIndex = 3
        Me.tabPage4.Text = "Cut off Header"
        Me.tabPage4.Visible = False
        '
        'button17
        '
        Me.button17.Location = New System.Drawing.Point(120, 208)
        Me.button17.Name = "button17"
        Me.button17.Size = New System.Drawing.Size(136, 23)
        Me.button17.TabIndex = 10
        Me.button17.Text = "fBmp_CutTifHeader"
        '
        'button16
        '
        Me.button16.Location = New System.Drawing.Point(256, 72)
        Me.button16.Name = "button16"
        Me.button16.Size = New System.Drawing.Size(75, 23)
        Me.button16.TabIndex = 9
        Me.button16.Text = "Browse"
        '
        'button15
        '
        Me.button15.Location = New System.Drawing.Point(256, 32)
        Me.button15.Name = "button15"
        Me.button15.Size = New System.Drawing.Size(75, 23)
        Me.button15.TabIndex = 8
        Me.button15.Text = "Browse"
        '
        'm_txtPageNo
        '
        Me.m_txtPageNo.Location = New System.Drawing.Point(136, 154)
        Me.m_txtPageNo.Name = "m_txtPageNo"
        Me.m_txtPageNo.Size = New System.Drawing.Size(100, 21)
        Me.m_txtPageNo.TabIndex = 7
        '
        'm_txtHeight
        '
        Me.m_txtHeight.Location = New System.Drawing.Point(136, 114)
        Me.m_txtHeight.Name = "m_txtHeight"
        Me.m_txtHeight.Size = New System.Drawing.Size(100, 21)
        Me.m_txtHeight.TabIndex = 6
        '
        'm_txtTargetFile1
        '
        Me.m_txtTargetFile1.Location = New System.Drawing.Point(136, 72)
        Me.m_txtTargetFile1.Name = "m_txtTargetFile1"
        Me.m_txtTargetFile1.Size = New System.Drawing.Size(100, 21)
        Me.m_txtTargetFile1.TabIndex = 5
        '
        'm_txtSourceFile
        '
        Me.m_txtSourceFile.Location = New System.Drawing.Point(136, 32)
        Me.m_txtSourceFile.Name = "m_txtSourceFile"
        Me.m_txtSourceFile.Size = New System.Drawing.Size(100, 21)
        Me.m_txtSourceFile.TabIndex = 4
        '
        'label24
        '
        Me.label24.Location = New System.Drawing.Point(40, 152)
        Me.label24.Name = "label24"
        Me.label24.Size = New System.Drawing.Size(64, 23)
        Me.label24.TabIndex = 3
        Me.label24.Text = "PageNo"
        '
        'label23
        '
        Me.label23.Location = New System.Drawing.Point(40, 112)
        Me.label23.Name = "label23"
        Me.label23.Size = New System.Drawing.Size(64, 23)
        Me.label23.TabIndex = 2
        Me.label23.Text = "Height"
        '
        'label22
        '
        Me.label22.Location = New System.Drawing.Point(40, 72)
        Me.label22.Name = "label22"
        Me.label22.Size = New System.Drawing.Size(80, 23)
        Me.label22.TabIndex = 1
        Me.label22.Text = "Target File"
        '
        'label21
        '
        Me.label21.Location = New System.Drawing.Point(40, 32)
        Me.label21.Name = "label21"
        Me.label21.Size = New System.Drawing.Size(80, 23)
        Me.label21.TabIndex = 0
        Me.label21.Text = "Source File"
        '
        'm_TrkChList
        '
        Me.m_TrkChList.Location = New System.Drawing.Point(16, 16)
        Me.m_TrkChList.Name = "m_TrkChList"
        Me.m_TrkChList.OcxState = CType(resources.GetObject("m_TrkChList.OcxState"), System.Windows.Forms.AxHost.State)
        Me.m_TrkChList.Size = New System.Drawing.Size(800, 80)
        Me.m_TrkChList.TabIndex = 11
        '
        'm_FaxChList
        '
        Me.m_FaxChList.Location = New System.Drawing.Point(8, 120)
        Me.m_FaxChList.Name = "m_FaxChList"
        Me.m_FaxChList.OcxState = CType(resources.GetObject("m_FaxChList.OcxState"), System.Windows.Forms.AxHost.State)
        Me.m_FaxChList.Size = New System.Drawing.Size(808, 96)
        Me.m_FaxChList.TabIndex = 12
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(832, 578)
        Me.Controls.Add(Me.m_FaxChList)
        Me.Controls.Add(Me.m_TrkChList)
        Me.Controls.Add(Me.m_TabCtrl)
        Me.Controls.Add(Me.groupBox5)
        Me.Controls.Add(Me.groupBox3)
        Me.Controls.Add(Me.groupBox4)
        Me.Controls.Add(Me.groupBox2)
        Me.Controls.Add(Me.radioButton4)
        Me.Controls.Add(Me.groupBox1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.groupBox2.ResumeLayout(False)
        Me.groupBox2.PerformLayout()
        Me.groupBox1.ResumeLayout(False)
        Me.groupBox5.ResumeLayout(False)
        Me.groupBox5.PerformLayout()
        Me.groupBox3.ResumeLayout(False)
        Me.groupBox4.ResumeLayout(False)
        Me.m_TabCtrl.ResumeLayout(False)
        Me.tabPage1.ResumeLayout(False)
        Me.tabPage1.PerformLayout()
        Me.tabPage2.ResumeLayout(False)
        Me.tabPage2.PerformLayout()
        Me.tabPage3.ResumeLayout(False)
        Me.tabPage3.PerformLayout()
        Me.tabPage4.ResumeLayout(False)
        Me.tabPage4.PerformLayout()
        CType(Me.m_TrkChList, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.m_FaxChList, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Dim ffSCT(50) As FAX_FILE_SCT
    Dim m_FaxCh(500) As FAX_STRUCT
    Dim m_TrkCh(500) As TRUNK_STRUCT

    Dim m_bLog As Boolean
    Dim strbErrMsg As System.Text.StringBuilder = New System.Text.StringBuilder(200)
    Dim m_bRecord As Boolean
    Dim m_nAutoOrNot As Int32 = -1
    Dim m_szAppendFile As String
    Dim m_nTotalCh As Int32
    Dim path As String = System.IO.Directory.GetCurrentDirectory() + "\fax.log" + Chr(0)

    Dim m_nHowFile As Int32
    Dim nStartPage As Int32
    Dim nEndPage As Int32
    Dim nSCTNumber As Int32       'number of multi-file

    'set up a vacant queue
    Dim fxQueue As New System.Collections.Queue
    Dim faxQueue As System.Collections.Queue = System.Collections.Queue.Synchronized(fxQueue)

    Dim EventSet As EVENT_SET_INFO
    Dim aTimer As New System.Timers.Timer
    Dim m_cmbFaxCh_Text As String
    Public Const WM_USER As Int32 = &H400


    Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        RemoveHandler aTimer.Elapsed, AddressOf OnTimer
        SsmCloseCti()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Control.CheckForIllegalCrossThreadCalls = False

        m_szAppendFile = ""
        m_strAppendFile.Text = ""
        m_bRecord = False
        m_nHowFile = -1
        nStartPage = 1
        nEndPage = -1
        nSCTNumber = 0

        If (InitCtiBoard() = False) Then
            Dispose(True)
        End If

        InitFaxChListCtrl() 'initialize fax channel list
        InitTrunkChListCtrl() 'initialize trunk channel list
        UpdateFaxChListCtrl() 'update fax channel list
        UpdateTrunkChListCtrl() 'update trunk channel list

        Me.radioButton2.Checked = True
        Me.radioButton4.Checked = True
        Me.RadioButton6.Checked = True
        Me.RadioButton9.Checked = True

        m_nHowFile = 0
        Me.label12.Hide()
        Me.m_txtSendPath.Hide()
        Me.m_btnSendPath.Hide()
        Me.m_ListBox.Hide()
        Me.m_BtnAdd.Hide()
        Me.m_BtnDel.Hide()

        'set event_message programming mode 	
        EventSet.dwWorkMode = ShMsg.EVENT_CALLBACK
        EventSet.lpHandlerParam = New CallBackSubProc(AddressOf CallBack_MessageProc)
        SsmSetEvent(-1, -1, C_BOOL.C_TRUE, EventSet)
        SsmSetEvent(ShEvent.E_SYS_BargeIn, -1, C_BOOL.C_FALSE, EventSet)
        SsmSetEvent(ShEvent.E_PROC_RecordFile, -1, C_BOOL.C_FALSE, EventSet)

        aTimer.Interval = 500 '200
        aTimer.Enabled = True
        aTimer.AutoReset = True
        AddHandler aTimer.Elapsed, AddressOf OnTimer

    End Sub

    '    Private Sub Form1_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
    '        SsmCloseCti()
    '    End Sub

    Function InitCtiBoard() As Boolean

        Dim nCheck As Int32
        Dim nChk As Int32
        Dim szConfig As String
        Dim szIndex As String
        Dim i As Int32

        strbErrMsg = New System.Text.StringBuilder(500)

        szConfig = System.IO.Directory.GetCurrentDirectory() + "\ShConfig.ini" + Chr(0)
        szIndex = System.IO.Directory.GetCurrentDirectory() + "\ShIndex.ini" + Chr(0)
        'load configuration file and initialize system
        If SsmStartCti(szConfig, szIndex) <> 0 Then
            'get initialization error message
            SsmGetLastErrMsg(strbErrMsg)
            MsgBox(strbErrMsg.ToString())
            Return False
        End If
        'Judge if the number of initialized boards is the same as
        '		   that of boards specified in the configuration file
        If SsmGetMaxUsableBoard() <> SsmGetMaxCfgBoard() Then
            SsmGetLastErrMsg(strbErrMsg)
            MsgBox(strbErrMsg.ToString())
            Return False
        End If

        m_nTotalCh = SsmGetMaxCh()  'get max channels of boards
        If m_nTotalCh = -1 Then
            WriteLog("Fail to call SsmGetMaxCh")
        End If
        For i = 0 To m_nTotalCh - 1
            m_TrkCh(i).bEnCalled = False
            nCheck = SsmGetChType(i)
            If (nCheck = -1) Then
                WriteLog("Fail to call SsmGetChType")
                'fax channel or soft fax
            ElseIf (nCheck = ChType.FAX_CH Or nCheck = ChType.SOFTFAX_CH) Then

                Dim FaxFileSCT(50) As FAX_FILE_SCT

                m_FaxCh(i).pffSCT = FaxFileSCT
                m_FaxCh(i).szChErrMsg = ""
                m_FaxCh(i).szRcvPathFile = ""
                m_FaxCh(i).szSendFile = ""
                m_FaxCh(i).szSendPath = ""
                m_FaxCh(i).szPage = ""
                m_FaxCh(i).szGetID = ""
                m_FaxCh(i).nStep = FaxChStep.FAX_IDLE
                m_FaxCh(i).nAnswered = 0
                m_FaxCh(i).bUseful = False
                m_FaxCh(i).nAllBytes = 0
                m_FaxCh(i).nSendBytes = 0

⌨️ 快捷键说明

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