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

📄 phonepcdlg.cpp

📁 手机串口通信设置程序
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	m_RandomButton1.ShowWindow(SW_SHOW);
	m_RandomButton2.ShowWindow(SW_SHOW);
	m_pGroupRandomRadio->ShowWindow(SW_SHOW);
	m_RandomPinLen.ShowWindow(SW_SHOW);
	m_ComboPinLen.ShowWindow(SW_SHOW);
	m_FixPin.ShowWindow(SW_SHOW);
	m_FixPinEdit.ShowWindow(SW_SHOW);
	m_SimSetting.ShowWindow(SW_SHOW);
	m_PhoneLockSim.ShowWindow(SW_SHOW);
	m_PhoneSimButton1.ShowWindow(SW_SHOW);
	m_PhoneSimButton2.ShowWindow(SW_SHOW);
	m_pGroupPhoneSimRadio->ShowWindow(SW_SHOW);
	m_LockSimNum.ShowWindow(SW_SHOW);
	m_LockSimNumEdit.ShowWindow(SW_SHOW);
	m_LockSimNumLen.ShowWindow(SW_SHOW);
	
	m_nPinSim = CONTROL_SHOW;
}

void CPhonePCDlg::CreatPinSiminfo()
{
	RECT rect;
	CFont* p_font = NULL;
	
	p_font = m_str.GetFont();

	rect.left = 220;
	rect.right =rect.left + 100;
	rect.top = 45;
	rect.bottom = rect.top + 20;
	
	m_PinSetting.Create("PIN码设置",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);
	m_PinSetting.SetFont(p_font,TRUE);
	m_PinSetting.ShowWindow(SW_SHOW);

	rect.left = 250;
	rect.right =rect.left + 100;
	rect.top = 68;
	rect.bottom = rect.top + 20;
	
	m_AutoLockPin.Create("自动锁PIN码:",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);
	m_AutoLockPin.SetFont(p_font,TRUE);
	

	rect.left = 350;
	rect.right =rect.left + 50;
	rect.top = 65;
	rect.bottom = rect.top + 20;
//	BS_AUTORADIOBUTTON 
//		BS_RADIOBUTTON
	m_RadioButtonAutoPin1.Create("是",WS_GROUP | BS_AUTORADIOBUTTON,   rect,   this,   ID_RADIO_BUTTONAUTO);
	m_RadioButtonAutoPin1.SetFont(p_font,TRUE);	
	m_RadioButtonAutoPin1.ShowWindow(SW_SHOW);

	rect.left = 400;
	rect.right =rect.left + 50;
	rect.top = 65;
	rect.bottom = rect.top + 20;
	m_RadioButtonAutoPin2.Create("否",BS_AUTORADIOBUTTON,   rect,   this,   ID_RADIO_BUTTONPIN);
	m_RadioButtonAutoPin2.SetFont(p_font,TRUE);	
	m_RadioButtonAutoPin2.ShowWindow(SW_SHOW);

	m_pGroupRadio   =  new   CStatic();			//group box
//	m_pGroupRadio->Create(_T("Test"),   WS_CHILD | WS_VISIBLE |SS_ETCHEDFRAME,   CRect(  CPoint(   200,   200   ),   CSize(   100,   30   )   ),   this   ); 
	m_pGroupRadio->Create(_T("Test"),   WS_CHILD | WS_VISIBLE |SS_ETCHEDFRAME,   CRect(  CPoint(345,60), CSize(110,30 )),   this   ); 
	

	rect.left = 250;
	rect.right =rect.left + 100;
	rect.top = 105;
	rect.bottom = rect.top + 20;

	m_InitPin.Create("初始PIN码:",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);
	m_InitPin.SetFont(p_font,TRUE);
	m_InitPin.ShowWindow(SW_SHOW);
	

	rect.left =	345;//			(prect->right + prect->left)/2;
	rect.right =rect.left + 110;
	rect.top = 100;
	rect.bottom = rect.top + 20;
	
	m_InitPinEdit.CreateEx(WS_EX_CLIENTEDGE, // 3D-border外观
        _T("EDIT"), 
        NULL,
        ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_CHILD,
        rect, this,
        ID_MYEDT);//生成edit控件,初始PIN码
//	m_InitPinEdit.SetWindowText(m_strLOCAL_1000_strLocalZone);
	m_InitPinEdit.SetFont(p_font);	
	m_InitPinEdit.ShowWindow(SW_SHOW); //显示控件
	m_InitPinEdit.SetFocus(); //设置焦点

	rect.left = 250;
	rect.right =rect.left + 100;
	rect.top = 140;
	rect.bottom = rect.top + 20;
	
	m_RandomPin.Create("使用随机PIN码:",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);
	m_RandomPin.SetFont(p_font,TRUE);
	m_RandomPin.ShowWindow(SW_SHOW);

	rect.left = 350;
	rect.right =rect.left + 50;
	rect.top = 138;
	rect.bottom = rect.top + 20;
	//	BS_AUTORADIOBUTTON 
	//		BS_RADIOBUTTON
	m_RandomButton1.Create("是",WS_GROUP | BS_AUTORADIOBUTTON,   rect,   this,   ID_RADIO_BUTTONRADOM);
	m_RandomButton1.SetFont(p_font,TRUE);	
	m_RandomButton1.ShowWindow(SW_SHOW);
	
	rect.left = 400;
	rect.right =rect.left + 50;
	rect.top = 138;
	rect.bottom = rect.top + 20;
	m_RandomButton2.Create("否",BS_AUTORADIOBUTTON,   rect,   this,   ID_RADIO_BUTTONNORADOM);
	m_RandomButton2.SetFont(p_font,TRUE);	
	m_RandomButton2.ShowWindow(SW_SHOW);
	
	m_pGroupRandomRadio   =  new   CStatic();			//group box
	m_pGroupRandomRadio->Create(_T("Test"),   WS_CHILD | WS_VISIBLE |SS_ETCHEDFRAME,   CRect(  CPoint(345,133), CSize(110,30 )),   this   ); 


	rect.left = 250;
	rect.right =rect.left + 100;
	rect.top = 180;
	rect.bottom = rect.top + 20;
	
	m_RandomPinLen.Create("随机PIN码长度:",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);
	m_RandomPinLen.SetFont(p_font,TRUE);
	m_RandomPinLen.ShowWindow(SW_SHOW);


	rect.left = 345;
	rect.right =rect.left + 110;
	rect.top = 175;
	rect.bottom = rect.top + 100;

	//随机PIN码长度
	m_ComboPinLen.Create(WS_VISIBLE | WS_CHILD | WS_BORDER | CBS_DROPDOWNLIST, rect, this, ID_COMBO_WAY);
	p_font = m_str.GetFont();
	m_ComboPinLen.SetFont(p_font,TRUE);
	
	int i;
	for(i=0;i<5;i++)
	{
		char str2[8];
		sprintf(str2,"%d",i+4);
		m_ComboPinLen.AddString(str2);
//		m_ComboPinLen.SetItemData(i,i);		
	}
	
	m_ComboPinLen.SetCurSel(0);
	m_ComboPinLen.ShowWindow(SW_SHOW);
	

	rect.left = 250;
	rect.right =rect.left + 100;
	rect.top = 220;
	rect.bottom = rect.top + 20;
	
	m_FixPin.Create("固定PIN码:",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);
	m_FixPin.SetFont(p_font,TRUE);
	m_FixPin.ShowWindow(SW_SHOW);

	rect.left = 345;
	rect.right =rect.left + 110;
	rect.top = 215;
	rect.bottom = rect.top + 20;
	
	m_FixPinEdit.CreateEx(WS_EX_CLIENTEDGE, // 3D-border外观
        _T("EDIT"), 
        NULL,
        ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_CHILD,
        rect, this,
        ID_MYEDT);//生成edit控件, 固定PIN码
	//	m_InitPinEdit.SetWindowText(m_strLOCAL_1000_strLocalZone);
	m_FixPinEdit.SetFont(p_font);	
	m_FixPinEdit.ShowWindow(SW_SHOW); //显示控件
//	m_FixPinEdit.SetFocus(); //设置焦点
	

	rect.left = 220;
	rect.right =rect.left + 100;
	rect.top = 240;
	rect.bottom = rect.top + 20;
	m_SimSetting.Create("SIM卡设置",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);  //SIM卡设置
	m_SimSetting.SetFont(p_font,TRUE);
	m_SimSetting.ShowWindow(SW_SHOW);	
	
//	m_PhoneLockSim

	rect.left = 250;
	rect.right =rect.left + 120;
	rect.top = 260;
	rect.bottom = rect.top + 20;
	m_PhoneLockSim.Create("设置话机绑定SIM卡:",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);  //SIM卡设置
	m_PhoneLockSim.SetFont(p_font,TRUE);
	m_PhoneLockSim.ShowWindow(SW_SHOW);


	rect.left = 350 + 20;
	rect.right =rect.left + 50;
	rect.top = 260;
	rect.bottom = rect.top + 20;
	m_PhoneSimButton1.Create("是",WS_GROUP | BS_AUTORADIOBUTTON,   rect,   this,   ID_RADIO_BUTTONSIMPHONE);
	m_PhoneSimButton1.SetFont(p_font,TRUE);	
	m_PhoneSimButton1.ShowWindow(SW_SHOW);
	
	rect.left = 400 + 20;
	rect.right =rect.left + 50;
	rect.top = 260;
	rect.bottom = rect.top + 20;
	m_PhoneSimButton2.Create("否",BS_AUTORADIOBUTTON,   rect,   this,   ID_RADIO_BUTTONSIMNO);
	m_PhoneSimButton2.SetFont(p_font,TRUE);	
	m_PhoneSimButton2.ShowWindow(SW_SHOW);
	
	m_pGroupPhoneSimRadio   =  new   CStatic();			//group box
	m_pGroupPhoneSimRadio->Create(_T("Test"),   WS_CHILD | WS_VISIBLE |SS_ETCHEDFRAME,   CRect(  CPoint(345 + 20,253), CSize(110,30 )),   this   ); 
	

	rect.left = 250;
	rect.right =rect.left + 120;
	rect.top = 300;
	rect.bottom = rect.top + 20;
	m_LockSimNum.Create("话机绑定的SIM卡号:",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);  //SIM卡设置
	m_LockSimNum.SetFont(p_font,TRUE);
	m_LockSimNum.ShowWindow(SW_SHOW);


	rect.left = 345 + 20;
	rect.right =rect.left + 110;
	rect.top = 295;
	rect.bottom = rect.top + 20;
	
	m_LockSimNumEdit.CreateEx(WS_EX_CLIENTEDGE, // 3D-border外观
        _T("EDIT"), 
        NULL,
        ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_CHILD,
        rect, this,
        ID_MYEDT);//生成edit控件
	//	m_InitPinEdit.SetWindowText(m_strLOCAL_1000_strLocalZone);
	m_LockSimNumEdit.SetFont(p_font);	
	m_LockSimNumEdit.ShowWindow(SW_SHOW); //显示控件
	//	m_FixPinEdit.SetFocus(); //设置焦点

	
	rect.left = 460 + 20;
	rect.right =rect.left + 100;
	rect.top = 300;
	rect.bottom = rect.top + 20;
	m_LockSimNumLen.Create("(少于19位)",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);  //SIM卡设置
	m_LockSimNumLen.SetFont(p_font,TRUE);
	m_LockSimNumLen.ShowWindow(SW_SHOW);


	char sTestplan[300];
	GetPrivateProfileString("PinAndSim","AutoLockPin","ERROR",sTestplan,sizeof(sTestplan),strConfigfile);
	if(strcmp(sTestplan,"ERROR")==0)
	{
		AfxMessageBox("读取PIN码和SIM卡设置信息失败!");
		return;
	}
	m_strPINSIM_6000_bAutoLockPin = sTestplan;
	
	int nLockPin = atoi(m_strPINSIM_6000_bAutoLockPin);
	if(nLockPin)
    	m_RadioButtonAutoPin1.SetCheck(TRUE);
	else
		m_RadioButtonAutoPin2.SetCheck(TRUE);
		
	
	GetPrivateProfileString("PinAndSim","OriginalPin","ERROR",sTestplan,sizeof(sTestplan),strConfigfile);
	m_strPINSIM_6002_strOriginalPin = sTestplan;
	m_InitPinEdit.SetWindowText(m_strPINSIM_6002_strOriginalPin);

	GetPrivateProfileString("PinAndSim","UseRandomPin","ERROR",sTestplan,sizeof(sTestplan),strConfigfile);
	m_strPINSIM_6005_bUseRandomPin = sTestplan;
	int nUseRandom;
	nUseRandom = atoi(m_strPINSIM_6005_bUseRandomPin);
	if(nUseRandom)
		m_RandomButton1.SetCheck(TRUE);
	else
		m_RandomButton2.SetCheck(FALSE);



	GetPrivateProfileString("PinAndSim","RandomPinLen","ERROR",sTestplan,sizeof(sTestplan),strConfigfile);
	m_strPINSIM_6001_nPinLength = sTestplan;
	int PinLength = atoi(m_strPINSIM_6001_nPinLength);

	for(i = 4;i<9;i++)
	{
		CString strtmp;
		strtmp.Format("%d",i);
		m_ComboPinLen.AddString(strtmp);
	}
	if(PinLength < 4 || PinLength > 8)
	{
		AfxMessageBox("读取随机PIN码长度错误!");
//		return;
	}
	m_ComboPinLen.SetCurSel(PinLength - 4);

	GetPrivateProfileString("PinAndSim","FixPin","ERROR",sTestplan,sizeof(sTestplan),strConfigfile);
	m_strPINSIM_6004_strFixedPin = 	sTestplan;	//固定PIN码
	m_FixPinEdit.SetWindowText(m_strPINSIM_6004_strFixedPin);

	GetPrivateProfileString("PinAndSim","PhoneSim","ERROR",sTestplan,sizeof(sTestplan),strConfigfile);
	m_strPINSIM_7000_bLockSim = sTestplan;
	int nLockSim;
	nLockSim = atoi(m_strPINSIM_7000_bLockSim);
	if(nLockSim == 1)
		m_PhoneSimButton1.SetCheck(TRUE);
	else
		m_PhoneSimButton2.SetCheck(TRUE);

	GetPrivateProfileString("PinAndSim","PhoneSimNumber","ERROR",sTestplan,sizeof(sTestplan),strConfigfile);
	m_strPINSIM_7001_strLockSimNum = sTestplan;
	m_LockSimNumEdit.SetWindowText(m_strPINSIM_7001_strLockSimNum);


	//对控件有效否进行设置
	if(nLockPin == 0)
	{
		m_InitPinEdit.EnableWindow(FALSE);
		m_RandomButton1.EnableWindow(FALSE);
		m_RandomButton2.EnableWindow(FALSE);
		m_ComboPinLen.EnableWindow(FALSE);
		m_FixPinEdit.EnableWindow(FALSE);
	}
	else
	{
		if(nUseRandom == 0)
		{
			m_ComboPinLen.EnableWindow(FALSE);
			m_FixPinEdit.EnableWindow(TRUE);
		}
		else
		{
			m_ComboPinLen.EnableWindow(TRUE);
			m_FixPinEdit.EnableWindow(FALSE);			
		}
			
	}
	if(nLockSim)
	{
		m_LockSimNumEdit.EnableWindow(TRUE);
	}
	else
		m_LockSimNumEdit.EnableWindow(FALSE);

//	CStatic *m_picture;
//	m_picture = new CPictureCtrl();
/*	CStatic m_picture;
	m_picture.Create(_T("picture"),   
		WS_EX_TRANSPARENT|WS_CHILD|WS_VISIBLE|WS_TABSTOP,   
		CRect(   
		0,   
		65,   
		0   +   100,   
		65 + 10),   
		this,   
		IDC_STATIC_LINE0);*/
	m_nPinSim = CONTROL_CREATED;
}
void CPhonePCDlg::HideLockPhone()
{
	m_LockOperator.ShowWindow(SW_HIDE);
		m_AutoLockOperator.ShowWindow(SW_HIDE);
		m_RadioLockOperator1.ShowWindow(SW_HIDE);
		m_RadioLockOperator2.ShowWindow(SW_HIDE);
		m_pGroupLockOpertor->ShowWindow(SW_HIDE);
		m_OperatorLocked.ShowWindow(SW_HIDE);
		m_ComboOperator.ShowWindow(SW_HIDE);
		m_LockCell.ShowWindow(SW_HIDE);
		m_boolLockCell.ShowWindow(SW_HIDE);
		m_RadioLockCell1.ShowWindow(SW_HIDE);
		m_RadioLockCell2.ShowWindow(SW_HIDE);
		m_pGroupLockCell->ShowWindow(SW_HIDE);
		m_LockCellNum.ShowWindow(SW_HIDE);
		m_ComboOperatorNum.ShowWindow(SW_HIDE);
		m_AutoLockCell.ShowWindow(SW_HIDE);
		m_RadioAutoLockCell1.ShowWindow(SW_HIDE);
		m_RadioAutoLockCell2.ShowWindow(SW_HIDE);
		m_pGroupAutoLockCell->ShowWindow(SW_HIDE);
		m_AutoLockCellNum.ShowWindow(SW_HIDE);
		m_list.ShowWindow(SW_HIDE);
	m_nLockPhone = CONTROL_HIDE;
}
void CPhonePCDlg::ShowLockPhone()
{
	m_LockOperator.ShowWindow(SW_SHOW);
	m_AutoLockOperator.ShowWindow(SW_SHOW);
	m_RadioLockOperator1.ShowWindow(SW_SHOW);
	m_RadioLockOperator2.ShowWindow(SW_SHOW);
	m_pGroupLockOpertor->ShowWindow(SW_SHOW);
		m_OperatorLocked.ShowWindow(SW_SHOW);
	m_ComboOperator.ShowWindow(SW_SHOW);
	m_LockCell.ShowWindow(SW_SHOW);
	m_boolLockCell.ShowWindow(SW_SHOW);
	m_RadioLockCell1.ShowWindow(SW_SHOW);
	m_RadioLockCell2.ShowWindow(SW_SHOW);
	m_pGroupLockCell->ShowWindow(SW_SHOW);
	m_LockCellNum.ShowWindow(SW_SHOW);
	m_ComboOperatorNum.ShowWindow(SW_SHOW);
	m_AutoLockCell.ShowWindow(SW_SHOW);
	m_RadioAutoLockCell1.ShowWindow(SW_SHOW);
	m_RadioAutoLockCell2.ShowWindow(SW_SHOW);
	m_pGroupAutoLockCell->ShowWindow(SW_SHOW);
		m_AutoLockCellNum.ShowWindow(SW_SHOW);
	m_list.ShowWindow(SW_SHOW);
	
	m_nLockPhone = CONTROL_SHOW;
}
void CPhonePCDlg::CreatLockPhone()
{
	RECT rect;
	CFont* p_font = NULL;
	
	p_font = m_str.GetFont();

	rect.left = 220;
	rect.right =rect.left + 100;
	rect.top = 45;
	rect.bottom = rect.top + 20;
	
	m_LockOperator.Create("锁定运营商",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);
	m_LockOperator.SetFont(p_font,TRUE);
	m_LockOperator.ShowWindow(SW_SHOW);

	rect.left = 250;
	rect.right =rect.left + 130;
	rect.top = 68;
	rect.bottom = rect.top + 20;
	
	m_AutoLockOperator.Create("是否自动锁定运营商:",WS_CHILD|WS_VISIBLE|SS_NOTIFY,rect,this,ID_STATIC_DIA);
	m_AutoLockOperator.SetFont(p_font,TRUE);

	rect.left = 350 + 30;
	rect.right =rect.left + 50;
	rect.top = 65;
	rect.bottom = rect.top + 20;
	//	BS_AUTORADIOBUTTON 
	//		BS_RADIOBUTTON
	m_RadioLockOperator1.Create("是",WS_GROUP | BS_AUTORADIOBUTTON,   rect,   this,   ID_RADIOLOCKOPERATOR);
	m_RadioLockOperator1.SetFont(p_font,TRUE);	
	m_RadioLockOperator1.ShowWindow(SW_SHOW);

⌨️ 快捷键说明

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