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

📄 form1.cs

📁 三汇pcifax卡的demo用csharp写的
💻 CS
📖 第 1 页 / 共 5 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO ;
using System.Resources;
using System.Text;
using System.Threading;
using System.Timers;
using System.Runtime.InteropServices;






namespace WindowsApplication1
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.RadioButton radioButton1;
		private System.Windows.Forms.RadioButton radioButton2;
		private System.Windows.Forms.RadioButton radioButton3;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.GroupBox groupBox4;
		private System.Windows.Forms.GroupBox groupBox5;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.RadioButton radioButton4;
		private System.Windows.Forms.RadioButton radioButton5;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.CheckBox checkBox1;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Button button4;
		private System.Windows.Forms.TabControl m_TabCtrl;
		private System.ComponentModel.IContainer components;

		public const int WM_USER = 0x0400;

		private System.Windows.Forms.TextBox m_txtSetFaxID;
		private System.Windows.Forms.Button button5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.RadioButton radioButton6;
		private System.Windows.Forms.RadioButton radioButton7;
		private System.Windows.Forms.RadioButton radioButton8;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.Label label12;
		private System.Windows.Forms.Label label13;
		private System.Windows.Forms.Label label14;
		private System.Windows.Forms.Button button10;
		private System.Windows.Forms.Label label15;
		private System.Windows.Forms.Label label16;
		private System.Windows.Forms.Label label17;
		private System.Windows.Forms.Label label18;
		private System.Windows.Forms.Label label19;
		private System.Windows.Forms.Label label20;
		private System.Windows.Forms.Button button12;
		private System.Windows.Forms.Button button13;
		private System.Windows.Forms.Button button14;
		private System.Windows.Forms.Label label21;
		private System.Windows.Forms.Label label22;
		private System.Windows.Forms.Label label23;
		private System.Windows.Forms.Label label24;
		private System.Windows.Forms.Button button15;
		private System.Windows.Forms.Button button16;
		private System.Windows.Forms.Button button17;
		private System.Windows.Forms.ComboBox m_cmbTrkCh1;
		private System.Windows.Forms.ComboBox m_cmbFaxCh1;
		private System.Windows.Forms.TextBox m_txtCallNo;
		private System.Windows.Forms.Button m_btnSendFile;
		private System.Windows.Forms.TextBox m_txtSendFile;
		private System.Windows.Forms.TextBox m_txtRcvFile;
		private System.Windows.Forms.TextBox m_txtSendPath;
		private System.Windows.Forms.Button m_btnSendPath;
		private System.Windows.Forms.TextBox m_txtStartPage;
		private System.Windows.Forms.TextBox m_txtEndPage;
		private System.Windows.Forms.ListBox m_ListBox;
		private System.Windows.Forms.Button m_BtnDel;
		private System.Windows.Forms.Button m_BtnAdd;
		private System.Windows.Forms.Button FileShow;
		private System.Windows.Forms.TextBox m_txtTargetFile;
		private System.Windows.Forms.TextBox m_txtDataTime;
		private System.Windows.Forms.TextBox m_txtFaxSubject;
		private System.Windows.Forms.TextBox m_txtFaxTo;
		private System.Windows.Forms.TextBox m_txtFaxFrom;
		private System.Windows.Forms.TextBox m_txtTifName;
		private System.Windows.Forms.TextBox m_txtPageNo;
		private System.Windows.Forms.TextBox m_txtHeight;
		private System.Windows.Forms.TextBox m_txtTargetFile1;
		private System.Windows.Forms.TextBox m_txtSourceFile;
		private System.Windows.Forms.TextBox m_txtRcvFile0;
		public AxMSFlexGridLib.AxMSFlexGrid m_TrkChList;
		private AxMSFlexGridLib.AxMSFlexGrid m_FaxChList;
		private System.Windows.Forms.TextBox m_strAppendFile;


		[DllImport("SHP_A3.dll")]public static extern int SsmStartCti(string lpSsmCfgFileName, string lpIndexCfgFileName);
		[DllImport("SHP_A3.dll")]public static extern string SsmGetLastErrMsgA();
		[DllImport("SHP_A3.dll")]public static extern int SsmGetMaxCfgBoard();
		[DllImport("SHP_A3.dll")]public static extern int SsmGetMaxUsableBoard();
		[DllImport("SHP_A3.dll")]public static extern int SsmGetMaxCh();
		[DllImport("SHP_A3.dll")]public static extern int SsmGetChType(int ch);	
		[DllImport("SHP_A3.dll")]public static extern int SsmRecToFile(int ch,string pszFileName, int nFormat, uint dwStartPos, int dwLen, uint dwTime, int nMask);
		[DllImport("SHP_A3.dll")]public static extern int SsmPlayFile(int ch,string pszFileName, int nFormat, int dwStartPos, uint dwLen);
		[DllImport("SHP_A3.dll")]public static extern int SsmStopRecToFile(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmClearRxDtmfBuf(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmSetEvent(int wEvent, int nReference, bool bEnable, ref EVENT_SET_INFO pEventSet);
		[DllImport("SHP_A3.dll")]public static extern int SsmSetBargeInSens(int ch, int nBargeInSens);
		[DllImport("SHP_A3.dll")]public static extern int SsmSetDtrmLineVoltage(int ch, ushort wDtrmValtage);
		
		
		[DllImport("SHP_A3.dll")]public static extern int SsmCloseCti();
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxStartSendEx(int ch, string filename, int nStartPage, int nEndPage);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxGetAllBytes(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxGetChStateMsg(int ch ,byte[] buf);////////////////
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxGetID(int ch,byte[] myid);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxGetRcvBytes(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxGetSendBytes(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmGetAutoCallDirection(int ch, byte[] pnDirection); //int* pnDirection);
		[DllImport("SHP_A3.dll")]public static extern int SsmGetChState(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmLoadIndexData(int	nSegNo, string pAlias, int nCodec, string	pVocFile, int lStartPos, int lLen);//(int	nSegNo, byte[] pAlias, int nCodec, byte[]	pVocFile, int lStartPos, int lLen);
		[DllImport("SHP_A3.dll")]public static extern void SsmFaxSetMaxSpeed(int speed);

		[DllImport("SHP_A3.dll")]public static extern int SsmFaxAppendSend(int ch, string filename);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxStop(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxSetID(int ch,string myid);
		[DllImport("BMPUTIL.DLL")]public static extern int fBmp_AddTxtToTif(string szTifName, string szFaxFrom, string szFaxTo, string szFaxSubject, string szDataTime, string szTargetFile, int dwReserve);
		[DllImport("BMPUTIL.DLL")]public static extern void   fBmp_GetErrMsg(byte[] buf);
		[DllImport("BMPUTIL.DLL")]public static extern int fBmp_CutTifHeader(string szSource, string szTarget, int nHeight, int nPageNo, int dwReserve) ;
		[DllImport("BMPUTIL.DLL")]public static extern int fBmp_GetFileAllPage(string filename);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxStartSend(int ch,string filename);
		[DllImport("SHP_A3.dll")]public static extern void SsmGetLastErrMsg(byte[] szErrMsgBuf);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxSendMultiFile(int ch, string szPath, string szFile);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxSendMultiFileEx(int ch,  FAX_FILE_SCT[] pSCT,int nNum); //psct现只发现一个是否用数组待观
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxStartReceive(int ch,string filename);
		[DllImport("SHP_A3.dll")]public static extern int SsmFaxGetPages(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmPickup(int ch);
		[DllImport("SHP_A3.dll")]public static extern int SsmRecToFile(int ch, string pszFileName, int nFormat, int dwStartPos, int dwBytes, int dwTime, int nMask);
		[DllImport("SHP_A3.dll")]public static extern int SsmSetRecMixer(int ch, bool bEnRecMixer, int nMixerVolume);
		[DllImport("SHP_A3.dll")]public static extern int SsmGetCallerId(int ch, byte[] szCallerId);
		[DllImport("SHP_A3.dll")]public static extern int SsmSetDtmfStopPlay(int ch, bool bDspf);
		[DllImport("SHP_A3.dll")]public static extern int SsmPlayIndexString(int ch, string pszIdxStr);
		[DllImport("SHP_A3.dll")]public static extern int SsmStartTimer(int wDelay, int fuEvent);
		[DllImport("SHP_A3.dll")]public static extern int SsmTalkWith(int ch1,int ch2);
		[DllImport("SHP_A3.dll")]public static extern int SsmStopTimer(int nTimer);
		[DllImport("SHP_A3.dll")]public static extern int SsmStopPlayIndex(int ch); 
		[DllImport("SHP_A3.dll")]public static extern int SsmStopTalkWith(int ch1,int ch2);
		[DllImport("SHP_A3.dll")]public static extern int SsmAutoDial(int ch, string szPhoNum);
		[DllImport("SHP_A3.dll")]public static extern int SsmHangup (int ch) ;
		[DllImport("user32.dll", EntryPoint="SendMessageA")]public static extern int SendMessage (IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);





		//user-defined fax channel state
		enum FaxChStep
		{
			FAX_IDLE,					
			FAX_CHECK_END,			
		};

		enum FaxDir		
		{
			C_SEND_FAX,			//send fax
			C_RECEIVE_FAX		//receive fax
		};

		//type of channel
		enum ChType
		{
			ANALOG_CH=0,		//nalog trunk channel 
			INTER_CH=1,			//Station channel
			USER_CH=2,			//Station channel
			REC_CH=3,			//Record channel
			SS1_CH=4,			//Digital channel (SS1)
			FAX_CH=5,			//Fax channel
			TUP_CH=6,			//Digital channel (SS7 TUP)
			ISDN_USER_CH=7,		//Digital channel (ISDN user side)
			ISDN_NET_CH = 8,	//Digital channel (ISDN network side)
			SOFTFAX_CH = 9,		//Soft fax
			MAGNET_CH = 10		//Magnet channel
		};


		enum  ChState
		{
			S_CALL_STANDBY =0,					
			S_CALL_PICKUPED=1,					
			S_CALL_RINGING =2,					
			S_CALL_TALKING =3,					

			S_CALL_ANALOG_WAITDIALTONE  =4,		
			S_CALL_ANALOG_TXPHONUM      =5,	
			S_CALL_ANALOG_WAITDIALRESULT=6,	

			S_CALL_PENDING            =7,	
			S_CALL_OFFLINE            =8,		
			S_CALL_WAIT_REMOTE_PICKUP =9,		
			S_CALL_ANALOG_CLEAR      =10,		
			S_CALL_UNAVAILABLE       =11,		
			S_CALL_LOCKED            =12,	

			S_CALL_RemoteBlock	     =19,	
			S_CALL_LocalBlock        =20,	

			S_CALL_Ss1InWaitPhoNum  =30,		
			S_CALL_Ss1InWaitFwdStop =31,	
			S_CALL_Ss1InWaitCallerID=32,	
			S_CALL_Ss1InWaitKD      =33,	
			S_CALL_Ss1InWaitKDStop  =34,		
			S_CALL_SS1_SAYIDLE      =35,		
			S_CALL_SS1WaitIdleCAS   =36,		
			S_CALL_SS1PhoNumHoldup  =37,	
			S_CALL_Ss1InWaitStopSendA3p=38,		


			S_CALL_Ss1OutWaitBwdAck       =40,
			S_CALL_Ss1OutTxPhoNum         =41,
			S_CALL_Ss1OutWaitAppendPhoNum =42,	
			S_CALL_Ss1OutTxCallerID       =43,	
			S_CALL_Ss1OutWaitKB           =44,	
			S_CALL_Ss1OutDetectA3p        =45,	


			S_FAX_Wait    = S_CALL_STANDBY,	
			S_FAX_ROUND   = 50,					
			S_FAX_PhaseA  = 51,					
			S_FAX_PhaseB  = 52,				
			S_FAX_SendDCS = 53,					
			S_FAX_Train   = 54,				
			S_FAX_PhaseC  = 55,				
			S_FAX_PhaseD  = 56,				
			S_FAX_NextPage= 57,				
			S_FAX_AllSent = 58,					
			S_FAX_PhaseE  = 59,					
			S_FAX_Reset   = 60,				
			S_FAX_Init    = 61,					
			S_FAX_RcvDCS  = 62,					
			S_FAX_SendFTT = 63,					
			S_FAX_SendCFR = 64,				

			S_TUP_WaitPcmReset    = 70,		
			S_TUP_WaitSAM         = 71,		
			S_TUP_WaitGSM         = 72,		
			S_TUP_WaitCLF         = 73,		
			S_TUP_WaitPrefix      = 74,		
			S_TUP_WaitDialAnswer  = 75,		
			S_TUP_WaitRLG         = 76,		
			S_TUP_WaitSetCallerID = 77,       

			S_ISDN_OUT_WAIT_NET_RESPONSE	= 81,
			S_ISDN_OUT_PLS_APPEND_NO		= 82,
			S_ISDN_IN_CHK_CALL_IN			= 83,
			S_ISDN_IN_RCVING_NO				= 84,
			S_ISDN_IN_WAIT_TALK				= 85,
			S_ISDN_OUT_WAIT_ALERT			= 86,

			S_ISDN_CALL_BEGIN				= 87,	
			S_ISDN_WAIT_HUANGUP				= 88,

			S_CALL_SENDRING                 = 100, 

			S_SPY_STANDBY					= S_CALL_STANDBY,	
			S_SPY_RCVPHONUM                 = 105,				
			S_SPY_RINGING					= S_CALL_RINGING,	
			S_SPY_TALKING					= S_CALL_TALKING,	

			S_SPY_SS1RESET					= 110,	
			S_SPY_SS1WAITBWDACK				= 111,	
			S_SPY_SS1WAITKB					= 112,	

			S_ISUP_WaitSAM                 = 120,
			S_ISUP_WaitRLC                 = 121,
			S_ISUP_WaitReset               = 122,
			S_ISUP_LocallyBlocked          = 123,
			S_ISUP_RemotelyBlocked         = 124,
			S_ISUP_WaitDialAnswer          = 125,
			S_ISUP_WaitINF                 = 126,
			S_ISUP_WaitSetCallerID         = 127,
			S_DTRC_ACTIVE				   = 128,
	
			S_ISUP_Suspend				   = 129,
		};

		//user-defined trunk channel state
		enum TrkChState
		{
			TRK_IDLE,				
			TRK_PLAY_VOC1,				//Play voice 'this is fax demo system: press 1 to receive fax file; press 2 to transmit fax file'
			TRK_PLAY_VOC2,				//play voice 2:"please press key 'start' to continue"
			TRK_DIALING,				//dialing
			TRK_FAXING,					//faxing...
		};

		enum ShMsg
		{
			NO_EVENT, 
			EVENT_POLLING, 
			EVENT_CALLBACK, 
			EVENT_MESSAGE 
		};

	
		enum Event
		{
			E_PROC_Recognize			= 0x0000,
			E_CHG_ISDNStatus			= 0x0001,
			E_RCV_Ss7Msu				= 0x0002,
			E_CHG_Mtp3State				= 0x0003,
			E_CHG_FaxChState			= 0x0004,
			E_CHG_FaxPages				= 0x0005,
			E_PROC_FaxEnd				= 0x0006,
			E_CHG_PcmLinkStatus			= 0x0007,
			E_CHG_LineVoltage			= 0x0008,
			E_RCV_CAS					= 0x0009,
			E_RCV_R2					= 0x000a,
			E_PROC_WaitDTMF				= 0x000b,
			E_CHG_RcvDTMF				= 0x000c,
			E_PROC_SendDTMF				= 0x000d,
			E_PROC_SendFlash			= 0x000e,
			E_PROC_PlayEnd				= 0x000f,
			E_PROC_PlayFile				= 0x0010,
			E_PROC_PlayFileList			= 0x0011,
			E_PROC_PlayMem				= 0x0012,
			E_PROC_RecordEnd			= 0x0013,
			E_PROC_RecordFile			= 0x0014,
			E_PROC_RecordMem			= 0x0015,
			E_PROC_SendFSK				= 0x0016,
			E_PROC_RcvFSK				= 0x0017,
			E_CHG_ChState				= 0x0018,
			E_PROC_AutoDial				= 0x0019,
			E_CHG_RemoteChBlock			= 0x001a,
			E_CHG_RemotePCMBlock		= 0x001b,
			E_SYS_ActualPickup			= 0x001c,
			E_CHG_RingFlag				= 0x001d,
			E_CHG_RingCount				= 0x001e,

⌨️ 快捷键说明

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