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

📄 form1.vb

📁 三汇CTI示例程序源码
💻 VB
📖 第 1 页 / 共 5 页
字号:
        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.TabIndex = 9
        Me.button16.Text = "Browse"
        '
        'button15
        '
        Me.button15.Location = New System.Drawing.Point(256, 32)
        Me.button15.Name = "button15"
        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.TabIndex = 7
        Me.m_txtPageNo.Text = ""
        '
        'm_txtHeight
        '
        Me.m_txtHeight.Location = New System.Drawing.Point(136, 114)
        Me.m_txtHeight.Name = "m_txtHeight"
        Me.m_txtHeight.TabIndex = 6
        Me.m_txtHeight.Text = ""
        '
        'm_txtTargetFile1
        '
        Me.m_txtTargetFile1.Location = New System.Drawing.Point(136, 72)
        Me.m_txtTargetFile1.Name = "m_txtTargetFile1"
        Me.m_txtTargetFile1.TabIndex = 5
        Me.m_txtTargetFile1.Text = ""
        '
        'm_txtSourceFile
        '
        Me.m_txtSourceFile.Location = New System.Drawing.Point(136, 32)
        Me.m_txtSourceFile.Name = "m_txtSourceFile"
        Me.m_txtSourceFile.TabIndex = 4
        Me.m_txtSourceFile.Text = ""
        '
        '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.groupBox1.ResumeLayout(False)
        Me.groupBox5.ResumeLayout(False)
        Me.groupBox3.ResumeLayout(False)
        Me.groupBox4.ResumeLayout(False)
        Me.m_TabCtrl.ResumeLayout(False)
        Me.tabPage1.ResumeLayout(False)
        Me.tabPage2.ResumeLayout(False)
        Me.tabPage3.ResumeLayout(False)
        Me.tabPage4.ResumeLayout(False)
        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(100)
    Dim m_bRecord As Boolean        'true-Record  false-NoRecord
    Dim m_nAutoOrNot As Int32 = -1    ' 0-Auto
    Dim m_szAppendFile As String
    Dim m_nTotalCh As Int32
    Dim path As String = System.IO.Directory.GetCurrentDirectory() + "\fax.log"

    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)

    Public Const WM_USER As Int32 = &H400

    'Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    '(ByVal hwnd As IntPtr, ByVal wMsg As Long, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Long

    Declare Function PostMessage Lib "User32.dll" Alias "PostMessageA" (ByVal hWnd As IntPtr, ByVal wMsg As Integer, _
    ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        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 	
        Dim EventSet As EVENT_SET_INFO
        EventSet.dwWorkMode = ShMsg.EVENT_MESSAGE
        EventSet.lpHandlerParam = Me.Handle
        SsmSetEvent(-1, -1, True, EventSet)


        Dim aTimer As System.Timers.Timer = New System.Timers.Timer
        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"
        szIndex = System.IO.Directory.GetCurrentDirectory() + "\ShIndex.ini"
        ' 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
                m_FaxCh(i).nRcvBytes = 0
                m_FaxCh(i).nCheckEnd = 0
                Me.m_cmbFaxCh1.Items.Add(i.ToString())
                Me.m_cmbFaxChNo.Items.Add(i.ToString())
                Me.m_cmbFaxCh.Items.Add(i.ToString())

            Else

                Dim temp As Int32
                'get automatic call progress enable flag and call direction
                nCheck = SsmGetAutoCallDirection(i, temp)
                If (nCheck = -1) Then
                    WriteLog("Fail to call SsmGetAutoCallDirection")
                    'enable automatic call progress
                ElseIf (nCheck = 1) Then
                    m_TrkCh(i).nCallFlag = -1

⌨️ 快捷键说明

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