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

📄 form1.cs

📁 三汇pcifax卡的demo用csharp写的
💻 CS
📖 第 1 页 / 共 5 页
字号:
			this.label16.Name = "label16";
			this.label16.Size = new System.Drawing.Size(56, 23);
			this.label16.TabIndex = 1;
			this.label16.Text = "Fax From";
			// 
			// label15
			// 
			this.label15.Location = new System.Drawing.Point(16, 24);
			this.label15.Name = "label15";
			this.label15.Size = new System.Drawing.Size(64, 23);
			this.label15.TabIndex = 0;
			this.label15.Text = "Tif File";
			// 
			// tabPage4
			// 
			this.tabPage4.Controls.Add(this.button17);
			this.tabPage4.Controls.Add(this.button16);
			this.tabPage4.Controls.Add(this.button15);
			this.tabPage4.Controls.Add(this.m_txtPageNo);
			this.tabPage4.Controls.Add(this.m_txtHeight);
			this.tabPage4.Controls.Add(this.m_txtTargetFile1);
			this.tabPage4.Controls.Add(this.m_txtSourceFile);
			this.tabPage4.Controls.Add(this.label24);
			this.tabPage4.Controls.Add(this.label23);
			this.tabPage4.Controls.Add(this.label22);
			this.tabPage4.Controls.Add(this.label21);
			this.tabPage4.Location = new System.Drawing.Point(4, 21);
			this.tabPage4.Name = "tabPage4";
			this.tabPage4.Size = new System.Drawing.Size(352, 303);
			this.tabPage4.TabIndex = 3;
			this.tabPage4.Text = "Cut off Header";
			// 
			// button17
			// 
			this.button17.Location = new System.Drawing.Point(120, 208);
			this.button17.Name = "button17";
			this.button17.Size = new System.Drawing.Size(136, 23);
			this.button17.TabIndex = 10;
			this.button17.Text = "fBmp_CutTifHeader";
			this.button17.Click += new System.EventHandler(this.button17_Click);
			// 
			// button16
			// 
			this.button16.Location = new System.Drawing.Point(256, 72);
			this.button16.Name = "button16";
			this.button16.TabIndex = 9;
			this.button16.Text = "Browse";
			this.button16.Click += new System.EventHandler(this.button16_Click);
			// 
			// button15
			// 
			this.button15.Location = new System.Drawing.Point(256, 32);
			this.button15.Name = "button15";
			this.button15.TabIndex = 8;
			this.button15.Text = "Browse";
			this.button15.Click += new System.EventHandler(this.button15_Click);
			// 
			// m_txtPageNo
			// 
			this.m_txtPageNo.Location = new System.Drawing.Point(136, 154);
			this.m_txtPageNo.Name = "m_txtPageNo";
			this.m_txtPageNo.TabIndex = 7;
			this.m_txtPageNo.Text = "";
			// 
			// m_txtHeight
			// 
			this.m_txtHeight.Location = new System.Drawing.Point(136, 114);
			this.m_txtHeight.Name = "m_txtHeight";
			this.m_txtHeight.TabIndex = 6;
			this.m_txtHeight.Text = "";
			// 
			// m_txtTargetFile1
			// 
			this.m_txtTargetFile1.Location = new System.Drawing.Point(136, 72);
			this.m_txtTargetFile1.Name = "m_txtTargetFile1";
			this.m_txtTargetFile1.TabIndex = 5;
			this.m_txtTargetFile1.Text = "";
			// 
			// m_txtSourceFile
			// 
			this.m_txtSourceFile.Location = new System.Drawing.Point(136, 32);
			this.m_txtSourceFile.Name = "m_txtSourceFile";
			this.m_txtSourceFile.TabIndex = 4;
			this.m_txtSourceFile.Text = "";
			// 
			// label24
			// 
			this.label24.Location = new System.Drawing.Point(40, 152);
			this.label24.Name = "label24";
			this.label24.Size = new System.Drawing.Size(64, 23);
			this.label24.TabIndex = 3;
			this.label24.Text = "PageNo";
			// 
			// label23
			// 
			this.label23.Location = new System.Drawing.Point(40, 112);
			this.label23.Name = "label23";
			this.label23.Size = new System.Drawing.Size(64, 23);
			this.label23.TabIndex = 2;
			this.label23.Text = "Height";
			// 
			// label22
			// 
			this.label22.Location = new System.Drawing.Point(40, 72);
			this.label22.Name = "label22";
			this.label22.Size = new System.Drawing.Size(80, 23);
			this.label22.TabIndex = 1;
			this.label22.Text = "Target File";
			// 
			// label21
			// 
			this.label21.Location = new System.Drawing.Point(40, 32);
			this.label21.Name = "label21";
			this.label21.Size = new System.Drawing.Size(80, 23);
			this.label21.TabIndex = 0;
			this.label21.Text = "Source File";
			// 
			// m_TrkChList
			// 
			this.m_TrkChList.Location = new System.Drawing.Point(16, 16);
			this.m_TrkChList.Name = "m_TrkChList";
			this.m_TrkChList.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("m_TrkChList.OcxState")));
			this.m_TrkChList.Size = new System.Drawing.Size(800, 96);
			this.m_TrkChList.TabIndex = 8;
			// 
			// m_FaxChList
			// 
			this.m_FaxChList.Location = new System.Drawing.Point(16, 136);
			this.m_FaxChList.Name = "m_FaxChList";
			this.m_FaxChList.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("m_FaxChList.OcxState")));
			this.m_FaxChList.Size = new System.Drawing.Size(800, 104);
			this.m_FaxChList.TabIndex = 9;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(856, 604);
			this.Controls.Add(this.m_FaxChList);
			this.Controls.Add(this.m_TrkChList);
			this.Controls.Add(this.m_TabCtrl);
			this.Controls.Add(this.groupBox5);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.groupBox4);
			this.Name = "Form1";
			this.Text = "Form1";
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox3.ResumeLayout(false);
			this.groupBox4.ResumeLayout(false);
			this.groupBox5.ResumeLayout(false);
			this.m_TabCtrl.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			this.tabPage2.ResumeLayout(false);
			this.tabPage3.ResumeLayout(false);
			this.tabPage4.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.m_TrkChList)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.m_FaxChList)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}


		bool InitCtiBoard()	
		{
			string str;
			int nCheck;
			int nChk;
			//load configuration file and initialize system
			if (SsmStartCti("ShConfig.ini", "ShIndex.ini") == -1)
			{
				//get initialization error message
				MessageBox.Show(SsmGetLastErrMsgA());
				return false;
			}
			//Judge if the number of initialized boards is the same as
			//		   that of boards specified in the configuration file
			if(SsmGetMaxUsableBoard() != SsmGetMaxCfgBoard())
			{
				MessageBox.Show(SsmGetLastErrMsgA());
				return false;
			}

			m_nTotalCh = SsmGetMaxCh();		//get max channels of boards
			if(m_nTotalCh == -1)
				WriteLog("Fail to call SsmGetMaxCh");

			for(int i = 0; i < m_nTotalCh; i++)
			{
				m_TrkCh[i].bEnCalled = false;
				nCheck = SsmGetChType(i);
				if(nCheck == -1)
					WriteLog("Fail to call SsmGetChType");
					//fax channel or soft fax
				else if(nCheck == (int)ChType.FAX_CH || nCheck ==(int)ChType.SOFTFAX_CH)	
				{
					m_FaxCh[i].pffSCT =new FAX_FILE_SCT[50];
					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 = (int)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;
					str=i.ToString() ;
					this.m_cmbFaxCh1.Items.Add(str);
					this.m_cmbFaxChNo.Items.Add(str);
					this.m_cmbFaxCh.Items.Add(str);
				}
				else
				{
					byte[] temp=new byte[4];
					//get automatic call progress enable flag and call direction
					nCheck = SsmGetAutoCallDirection(i, temp);
					if(nCheck == -1)
						WriteLog("Fail to call SsmGetAutoCallDirection");
						//enable automatic call progress
					else if(nCheck == 1) 
					{	
						m_TrkCh[i].nCallFlag	 = -1;
						m_TrkCh[i].nStep         = (int)TrkChState.TRK_IDLE;
						m_TrkCh[i].szChErrMsg = " ";
						m_TrkCh[i].bEnCalled     = true;
						m_TrkCh[i].nAutoOrNot    = 0;
						m_TrkCh[i].bRecord		 = true;
						m_TrkCh[i].szDtmf	 = new char [100];
						m_TrkCh[i].szDtmf[0] = '\0';
						m_TrkCh[i].szDtmfChose = '\0';
						m_TrkCh[i].bUseful		 = false;
						m_TrkCh[i].nIndex		 = 0;
						m_TrkCh[i].nFirstDtmf    = 0;
						m_TrkCh[i].bLinked		 = false;
						m_TrkCh[i].nTimer		 = -1;
						m_TrkCh[i].szCallerId= "";
						str=i.ToString() ;	
						this.m_cmbTrkCh1.Items.Add(str);
						this.m_cmbTrkCh.Items .Add (str);
						this.m_cmbTrkChNo.Items.Add (str);
					}
				}
			}
			//load speech data "Step1.voc" and "Step2.voc"
			nCheck = SsmLoadIndexData(1, "", 6, "Step1.voc", 0, -1);
			nChk = SsmLoadIndexData(2, "", 6, "Step2.voc", 0, -1);
			if(nCheck == -1 || nChk == -1)		       
			{
				MessageBox.Show("Failed to load speech file");
				if(SsmCloseCti() == -1)
					WriteLog("Failed to call SsmCloseCti");
				return false;
			}

			return true;
		}	
	
	
		//write log messages
		void WriteLog(string szLog)
		{
			using (StreamWriter w = File.AppendText(path))
			{
				w.Write("\r\nLog Entry : ");
				w.WriteLine("{0} {1}",DateTime.Now .ToLongDateString(),DateTime.Now .ToLongTimeString ());
				w.WriteLine ("  :");
				w.WriteLine ("  :{0}",szLog);
				w.WriteLine ("-------------------------------");
				w.Flush(); 
				w.Close();
			}
			
		}
		void WriteLog1(string szLog)
		{
			using (StreamWriter w = File.AppendText(path1))
			{
				w.Write("\r\nLog Entry : ");
				w.WriteLine("{0} {1}",DateTime.Now .ToLongDateString(),DateTime.Now .ToLongTimeString ());
				w.WriteLine ("  :");
				w.WriteLine ("  :{0}",szLog);
				w.WriteLine ("-------------------------------");
				// Update the underlying file.
				w.Flush(); 
				w.Close();
				File.Delete (path1);
			}
			
		}


		void InitFaxChListCtrl()
		{
			int nIndex = 0;
			m_FaxChList.Cols =8;
			m_FaxChList.Row =0;

			m_FaxChList.Col = 0;
			m_FaxChList.Text = "Ch";

			m_FaxChList.Col = 1;
			m_FaxChList.Text = "Channel state";

			m_FaxChList.Col = 2;
			m_FaxChList.Text = "Page number";

			m_FaxChList.Col = 3;
			m_FaxChList.Text = "Remote ID";

			m_FaxChList.Col = 4;
			m_FaxChList.Text = "Current file name";

			m_FaxChList.Col = 5;
			m_FaxChList.Text = "Number of fax bytes";

			m_FaxChList.Col = 6;
			m_FaxChList.Text = "Execution result of faxing";

			m_FaxChList.Col = 7;
			m_FaxChList.Text = "Error message";

			m_FaxChList.set_ColWidth (0,30*12);
			m_FaxChList.set_ColWidth (1,130*12);
			m_FaxChList.set_ColWidth (2,40*12);
			m_FaxChList.set_ColWidth (3,100*12);
			m_FaxChList.set_ColWidth (4,150*12);
			m_FaxChList.set_ColWidth (5,150*12);
			m_FaxChList.set_ColWi

⌨️ 快捷键说明

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