Пример #1
0
BOOL CMyProgressDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	SetIcon(m_hIcon, false);
	
	*m_pHwnd = GetSafeHwnd();
	if(m_pEvent != NULL)
		m_pEvent->SetEvent();

	DWORD dwIds [] = {IDC_PROGRESS_TITLE_LABEL,
		ID_WIZBACK,
		ID_WIZNEXT,
		IDCANCEL,
					-1
					};

	MfcUtils::Localize(this, dwIds);

	CString csDlgTitle;
	csDlgTitle.LoadString(IDS_DIALOG_TITLE);

	SetWindowText(csDlgTitle);

	m_btnBack.EnableWindow(false);
	m_btnNext.EnableWindow(false);
	if(!m_bIsWizard)
	{
		m_btnBack.ShowWindow(SW_HIDE);
		m_btnNext.ShowWindow(SW_HIDE);
	}
   else
   {
      CRect btnRect;
		m_btnCancel.GetWindowRect(&btnRect);
      
		CRect client;
		GetClientRect(&client);
   
      CRect rectNext;
      m_btnNext.GetWindowRect(rectNext);

      int x = rectNext.right + 9;
		btnRect.SetRect(x, btnRect.top, x + btnRect.Width(), btnRect.top  + btnRect.Height());
		ScreenToClient(&btnRect);
		m_btnCancel.MoveWindow(&btnRect);
   }

	CString labelText;
	labelText.LoadString(IDS_TIME_LEFT);

	CWnd* label = GetDlgItem(IDC_LABEL_TIME);
	label->SetWindowText(labelText);

	label = GetDlgItem(IDC_LABEL_DURATION);
	labelText.LoadString(IDS_DURATION);
	labelText += _T("0:00");
	label->SetWindowText(labelText);

	m_iTimer = SetTimer(1, 1000, 0);
	m_pctProgress.SetRange(0,100);
	m_pctProgress.SetPos(0);
	
	SetForegroundWindow();
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
//=============================================================================
BOOL CXFolderDialog::OnInitDialog()
//=============================================================================
{
	TRACE(_T("in CXFolderDialog::OnInitDialog\n"));

	CFileDialog::OnInitDialog();

	// load folder history - check if valid folder
	m_cmbRecentFolders.SetMaxHistoryItems(50);
	m_cmbRecentFolders.SetDropSize(20);
	m_cmbRecentFolders.SetCheckAccess(TRUE);
	m_cmbRecentFolders.LoadHistory(_T("FolderHistory"), _T("Folder"));

	CString str;
	if (m_cmbRecentFolders.GetCount() > 0)
	{
		m_cmbRecentFolders.GetLBText(0, str);
		m_cmbRecentFolders.SetWindowText(str);
	}

	CWnd *pWndParent = GetParent();
	ASSERT(pWndParent && IsWindow(pWndParent->m_hWnd));

	// save left margin for combo boxes
	CWnd *pWndFileNameCombo = pWndParent->GetDlgItem(m_nIdFileNameCombo);
	if (!pWndFileNameCombo)
	{
		// the File Name control ID is either 1148 or 1152, depending on whether
		// it is used as an edit box (1152) or a combo box (1148).  If the OS
		// version is < 5, it is 1152; if >= 5, it is 1148.  It will also be
		// 1152 if the registry key
		//    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\comdlg32\NoFileMru
		// is set to 1.  For convenience, we will always refer to this control
		// as a combobox.
		m_nIdFileNameCombo = 1152;
		pWndFileNameCombo = pWndParent->GetDlgItem(m_nIdFileNameCombo);
	}

	CRect rect;

	CWnd *pWndFileNameStatic = pWndParent->GetDlgItem(m_nIdFileNameStatic);
	ASSERT(pWndFileNameStatic);
	if (pWndFileNameStatic)
	{
		pWndFileNameStatic->GetWindowRect(&rect);
		pWndParent->ScreenToClient(&rect);
		m_nStaticLeftMargin = rect.left;
	}
	else
	{
		m_nStaticLeftMargin = 60;
	}

	// set title if specified
	if (m_strTitle.IsEmpty())
		pWndParent->SetWindowText(_T("Select Folder"));
	else
		pWndParent->SetWindowText(m_strTitle);

	static BOOL bFirstTime = TRUE;
	if (bFirstTime)
	{
		bFirstTime = FALSE;
		CToolBarCtrl *ptb = (CToolBarCtrl *) pWndParent->GetDlgItem(m_nIdPlaceBar);
		if (ptb && IsWindow(ptb->m_hWnd))
			ptb->ShowWindow(SW_HIDE);
	}

	return TRUE;	// return TRUE unless you set the focus to a control
					// EXCEPTION: OCX Property Pages should return FALSE
}
Пример #3
0
BOOL CDlgFormulaFind::OnInitDialog() 
{
	CHSBaseDialog::OnInitDialog();

    CenterWindow( this->GetParent() );

/*	this->m_wndRangeCombo.SetItemData(0,DWORD(FindInName    ));
	this->m_wndRangeCombo.SetItemData(0,DWORD(FindInDescribe));
	this->m_wndRangeCombo.SetItemData(0,DWORD(FindInNotes   ));
	this->m_wndRangeCombo.SetItemData(0,DWORD(FindInEidolon ));
	this->m_wndRangeCombo.SetItemData(0,DWORD(FindInSource  ));
	this->m_wndRangeCombo.SetItemData(0,DWORD(FindInAll     ));
*/

	m_wndAnimate.Open(IDR_AVI1);
	m_wndAnimate.Stop();

	m_wndKeyCombo.SetEditSel(-1,0);

	m_wndResultList.ModifyStyle(0,LVS_REPORT|LVS_SINGLESEL);
	DWORD dwStyle = m_wndResultList.GetExtendedStyle();
	dwStyle &= ~LVS_EX_ONECLICKACTIVATE;
	dwStyle |= LVS_EX_FULLROWSELECT/*|LVS_EX_GRIDLINES|LVS_EX_TWOCLICKACTIVATE*//*|LVS_EX_UNDERLINEHOT*/;
	m_wndResultList.SetExtendedStyle(dwStyle);

	LV_COLUMN lvcolumn;
	lvcolumn.mask = LVCF_FMT|LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
	lvcolumn.fmt  = LVCFMT_CENTER;
	lvcolumn.cx   = 25;
	lvcolumn.iSubItem = 0;
	CString str;
	str = _T("序");
	lvcolumn.pszText = (char*)LPCTSTR(str);
	m_wndResultList.InsertColumn(0,&lvcolumn);
	//lvcolumn.cx   = 60;
	lvcolumn.iSubItem = 1;
	str = _T("名称");
	lvcolumn.pszText = (char*)LPCTSTR(str);
	lvcolumn.cx   = 65;
	m_wndResultList.InsertColumn(1,&lvcolumn);
	lvcolumn.iSubItem = 2;
	str = _T("描述");
	lvcolumn.pszText = (char*)LPCTSTR(str);
	lvcolumn.cx   = 130;
	m_wndResultList.InsertColumn(2,&lvcolumn);
	lvcolumn.iSubItem = 3;
	str = _T("位置");
	lvcolumn.pszText = (char*)LPCTSTR(str);
	lvcolumn.cx   = 60;
	m_wndResultList.InsertColumn(3,&lvcolumn);

	CWnd* pWnd = this->GetDlgItem(IDC_RESULTSTATIC);
	if( pWnd != NULL)
	{
		pWnd->SetWindowText(_T("0个对象"));
	}

	pWnd = GetDlgItem(IDC_STARTBUTTON);
	if( pWnd != NULL)
	{
		pWnd->EnableWindow(true);
	}
	pWnd = GetDlgItem(IDC_STOPBUT);
	if( pWnd != NULL)
	{
		pWnd->EnableWindow(false);
	}

	m_bCompAll = true;
	UpdateData(false);

	this->m_wndKeyCombo.SetFocus();

	return FALSE;
}
BOOL CPropPageRestore::CheckData()
{
    switch(m_iSource)
    {
    case FILE_MODE:
        if(m_strBackupPath.IsEmpty())
        {
            ::AfxMessageBox(IDS_ERR_NO_BACKUP_PATH);
            CWnd*   pWnd = GetDlgItem(IDC_BACKUP_PATH_EDIT);
            GotoDlgCtrl(pWnd);
            return FALSE;
        }
        else
        {
            if(m_strBackupPath.Find(_T('.')) == -1)
            {
                m_strBackupPath += _T(".4cb");
                CWnd*   pWnd = GetDlgItem(IDC_BACKUP_PATH_EDIT);
                pWnd->SetWindowText(m_strBackupPath);
                pWnd->UpdateWindow();
            }
            CFileStatus tStatus;
            if(!CFile::GetStatus(m_strBackupPath, tStatus))
            {
                ::AfxMessageBox(_T("Specified backup file does not exist."));
                CWnd*   pWnd = GetDlgItem(IDC_BACKUP_PATH_EDIT);
                GotoDlgCtrl(pWnd);
                return FALSE;
            }
        }
        break;
    case TARGET_MODE:
        if(m_strAddress.IsEmpty())
        {
            ::AfxMessageBox(IDS_ERR_NO_ADDRESS);
            CWnd*   pWnd = GetDlgItem(IDC_ADDRESS_EDIT);
            GotoDlgCtrl(pWnd);
            return FALSE;
        }
        break;
    }

    if(m_strProjectPath.IsEmpty())
    {
        ::AfxMessageBox(IDS_ERR_NO_PROJECT_PATH);
        CWnd*   pWnd = GetDlgItem(IDC_PROJECT_PATH_EDIT);
        GotoDlgCtrl(pWnd);
        return FALSE;
    }

    CFileStatus tStatus;
    if(CFile::GetStatus(m_strProjectPath, tStatus))
    {
        CString strMessage(_T("Project Path already exists."));
        ::AfxMessageBox(strMessage);
        m_pMainSheet->SetStatusText(strMessage);
        CWnd*   pWnd = GetDlgItem(IDC_PROJECT_PATH_EDIT);
        GotoDlgCtrl(pWnd);
        return FALSE;
    }
    return TRUE;
}
Пример #5
0
BOOL CInsertConstituentDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	int i,j;
	CString strTargetFont;
	CWnd* pWnd;
	CHARFORMAT2 cf;

//	CRect rect(55,23,223,48);
//	m_recConstituent.Create(ES_AUTOHSCROLL | WS_VISIBLE | WS_BORDER, rect, this, 1);
	i=m_pDoc->GetTargetEditControlHeight();
	pWnd=&m_recConstituent;
	pWnd->MoveWindow(55,15,338,i);
	j=(110-15+i)/2;   //find the middle between the bottom of the edit control and the top of the gloss control
	pWnd=GetDlgItem(IDC_COMBOTAGS);
	pWnd->MoveWindow(55,j,338,25);     //position the tags drop down between the target word control and the gloss control
	pWnd=GetDlgItem(IDC_STATICPOSTAG);
	pWnd->MoveWindow(25,j+4,25,18);
	memset(&cf, 0, sizeof(CHARFORMAT2));
	wcscpy_s(cf.szFaceName,m_strFontName);
	cf.dwMask = CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_BOLD; // | CFM_OFFSET;
	cf.bCharSet = DEFAULT_CHARSET;  //SYMBOL_CHARSET;
//	cf.yHeight = 200;
	i=m_pDoc->GetTargetLanguageFontSize();
	cf.yHeight=20*i;
//	cf.yOffset=0;
	cf.bPitchAndFamily = VARIABLE_PITCH | FF_DONTCARE;
	cf.dwEffects = !CFE_BOLD;
	m_recConstituent.SetDefaultCharFormat(cf);
	if (m_nView==0 || !m_pDoc->m_bShowTargetGlosses)    //if called from the lexicon, or if not showing target glosses
	{
		pWnd=GetDlgItem(IDC_RICHEDITTARGETGLOSS);
		pWnd->ShowWindow(SW_HIDE);
		pWnd=GetDlgItem(IDC_STATICTARGETGLOSS);
		pWnd->ShowWindow(SW_HIDE);
	}
	LoadTagsCombo();
	pWnd=&m_recConstituent;
	if (m_strWord!=L"")
	{
		i=m_strWord.Find(L"(");
		if (i>-1)
		{
			m_strGloss=m_strWord.Mid(i+1);  //get the gloss
			m_strGloss=m_strGloss.Left(m_strGloss.GetLength()-1);  //remove the final )
			m_strWord=m_strWord.Left(i);  //remove the gloss
			pWnd=GetDlgItem(IDC_RICHEDITTARGETGLOSS);
			pWnd->SetWindowText(m_strGloss);
		}
		i=m_strWord.Find(L"[");
		if (i>-1)
		{
			m_strTag=m_strWord.Mid(i+1);
			m_strWord=m_strWord.Left(i);
			i=m_strTag.GetLength();
			m_strTag=m_strTag.Left(i-1);  //remove final ]
			pWnd=&m_recConstituent;
			pWnd->SetWindowText(m_strWord);
			i=m_cboTags.SelectString(-1,m_strTag);
			UpdateData(FALSE);
		}
	}
	pWnd->SetFocus();
	return FALSE;
	//return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #6
0
BOOL CCreateBranchTagDlg::OnInitDialog()
{
	CResizableStandAloneDialog::OnInitDialog();
	CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

	CHOOSE_VERSION_ADDANCHOR;

	AddAnchor(IDC_GROUP_BRANCH, TOP_LEFT, TOP_RIGHT);

	AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);

	AddAnchor(IDOK,BOTTOM_RIGHT);
	AddAnchor(IDCANCEL,BOTTOM_RIGHT);
	AddAnchor(IDHELP, BOTTOM_RIGHT);
	AddAnchor(IDC_GROUP_MESSAGE,TOP_LEFT,BOTTOM_RIGHT);
	AddAnchor(IDC_EDIT_MESSAGE,TOP_LEFT,BOTTOM_RIGHT);

	this->AddOthersToAnchor();

	AdjustControlSize(IDC_RADIO_BRANCH);
	AdjustControlSize(IDC_RADIO_TAGS);
	AdjustControlSize(IDC_RADIO_VERSION);
	AdjustControlSize(IDC_CHECK_TRACK);
	AdjustControlSize(IDC_CHECK_FORCE);
	AdjustControlSize(IDC_CHECK_SWITCH);
	AdjustControlSize(IDC_CHECK_SIGN);

	this->SetDefaultChoose(IDC_RADIO_HEAD);

	InitChooseVersion();

	this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);

	CString sWindowTitle;
	if(this->m_bIsTag)
	{
		sWindowTitle = CString(MAKEINTRESOURCE(IDS_PROGS_TITLE_CREATETAG));
		this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_TAG)));
		this->GetDlgItem(IDC_CHECK_SIGN)->EnableWindow(!g_Git.GetConfigValue(_T("user.signingkey")).IsEmpty());
	}
	else
	{
		sWindowTitle = CString(MAKEINTRESOURCE(IDS_PROGS_TITLE_CREATEBRANCH));
		this->GetDlgItem(IDC_LABEL_BRANCH)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_BRANCH)));
		this->GetDlgItem(IDC_EDIT_MESSAGE)->EnableWindow(FALSE);
		this->GetDlgItem(IDC_CHECK_SIGN)->ShowWindow(SW_HIDE);
	}

	CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle);

	// show the switch checkbox if we are a create branch dialog
	this->GetDlgItem(IDC_CHECK_SWITCH)->ShowWindow(!m_bIsTag && !GitAdminDir::IsBareRepo(g_Git.m_CurrentDir));
	CWnd* pHead = GetDlgItem(IDC_RADIO_HEAD);
	CString HeadText;
	pHead->GetWindowText( HeadText );
	pHead->SetWindowText( HeadText + " (" + g_Git.GetCurrentBranch() + ")");
	AdjustControlSize(IDC_RADIO_HEAD);
	EnableSaveRestore(_T("BranchTagDlg"));

	m_tooltips.AddTool(GetDlgItem(IDC_CHECK_FORCE), CString(MAKEINTRESOURCE(IDS_PROC_NEWBRANCHTAG_FORCE_TT)));
	m_tooltips.AddTool(GetDlgItem(IDC_CHECK_SIGN), CString(MAKEINTRESOURCE(IDS_PROC_NEWBRANCHTAG_SIGN_TT)));
	m_tooltips.AddTool(GetDlgItem(IDC_CHECK_TRACK), CString(MAKEINTRESOURCE(IDS_PROC_NEWBRANCHTAG_TRACK_TT)));
	m_tooltips.Activate(TRUE);

	OnCbnSelchangeComboboxexBranch();
	return TRUE;
}
Пример #7
0
BOOL CAdminGen::OnInitDialog()
{
	/*CDialogEx::OnInitDialog();*/
	CDialogEx::OnInitDialog();
  

    // Add "About..." menu item to system menu.   
	
    // IDM_ABOUTBOX must be in the system command range.   
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);   
    ASSERT(IDM_ABOUTBOX < 0xF000);   

    CMenu* pSysMenu = GetSystemMenu(FALSE);   
    if (pSysMenu != NULL)   
    {   
        BOOL bNameValid;   
        CString strAboutMenu;   
        bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);   
        ASSERT(bNameValid);   
        if (!strAboutMenu.IsEmpty())   
        {   
            pSysMenu->AppendMenu(MF_SEPARATOR);   
            pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);   
        }   
    }   
  
    // Set the icon for this dialog.  The framework does this automatically   
    //  when the application's main window is not a dialog   
    SetIcon(m_hIcon, TRUE);         // Set big icon   
    SetIcon(m_hIcon, FALSE);        // Set small icon   
  
    // TODO: Add extra initialization here  
	//设置CComBox下拉框为只读防止用户自己输入造成不必要的错误
	CEdit* pEdit = (CEdit*)(((CComboBox*)GetDlgItem(IDC_ADMINTYPE_COMBO))->GetWindow(GW_CHILD));	
	pEdit->SetReadOnly(TRUE);
	CEdit* pEdit1 = (CEdit*)(((CComboBox*)GetDlgItem(IDC_PAPERTYPE_COMBO))->GetWindow(GW_CHILD));	
	pEdit1->SetReadOnly(TRUE);


	CWnd *cWnd = GetDlgItem(IDC_THETITLE_STATIC);
	cWnd->SetFont(&font);
	if(adm_index_array[0][0] == ADM_UPDATA)
	{
		cWnd->SetWindowText("更新管理员");
		SetDlgItemText(IDC_ADMINNAME_EDIT, m_adminname); 
		SetDlgItemText(IDC_ADMINPHONE_EDIT,adm_phoneNum_cs); 
		SetDlgItemText(IDC_PHONENUMBER_EDIT,adm_paperNum_cs); 
		SetDlgItemText(IDC_PAPERTYPE_COMBO,adm_paperType_cs); 
		SetDlgItemText(IDC_ADMINMAXCOUNT_EDIT,adm_maxNum_cs); 
		SetDlgItemText(IDC_ADMINTYPE_COMBO, _T("设备管理员"));
		m_adm_max_count.SetReadOnly(TRUE);
	}
	else
	{
		cWnd->SetWindowText("添加管理员");
		SetDlgItemText(IDC_PAPERTYPE_COMBO, _T("身份证"));
		SetDlgItemText(IDC_ADMINTYPE_COMBO, _T("设备管理员"));
		
	}
		
	 m_papertype.AddString(_T("身份证"));     
	 m_papertype.AddString(_T("其他")); 

	m_adminType.AddString(_T("设备管理员"));
	m_adminType.AddString(_T("密钥授权员"));
	m_adminType.AddString(_T("安全审计员"));

	//获取最大管理员数
	int ret = 0;
	DEVKEYINFO devInfo={0x00};
	char outString[100]={0x00};
	ret = Km_GetDevKeyInfo(phHandle,&devInfo);
	if(0 != ret)
	{
		retValueParse(ret,outString);
		MessageBox("获取设备密钥信息失败,错误码:"+(CString)outString,"提示",MB_ICONEXCLAMATION);
		return TRUE;
	}
	algID = devInfo.uiAlgo;
	keyLength = devInfo.uiKeyLen;
	if(keyLength == 2048)
		keyLength = 1024;
	isAddOK = TRUE;
//	int admMax_forLogin = devInfo.uiBakTotalKey;
	i_adm_log_num = admCountInGen;
//	int i_adm_log_num = 0.5*admMax_forLogin+1;
	if(1 <= admCountInGen)
	{
		CString admz_num;
		admz_num.Format("%d",admCountInGen);
		SetDlgItemText(IDC_ADMINMAXCOUNT_EDIT,admz_num);
		m_adm_max_count.SetReadOnly(TRUE);
	}
//	if(i_adm_log_num >= admMax_forLogin)
		//isAddOK = FALSE;
    return FALSE;  // return TRUE  unless you set the focus to a control   

}
Пример #8
0
void CManageMySQL::Getname(CString str,int classcount)
{
	int i = classcount + Page * 14;
	for (int i = 13;i >= 0;i--)
	{
		CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + i);
		DlgHwnd->SetWindowText(_T(""));
		DlgHwnd->ShowWindow(SW_HIDE);
		

	}//隐藏Button


	GetDlgItem(IDC_BUTTON15)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_BUTTON16)->ShowWindow(SW_HIDE);


	mysql_set_character_set(&my_connection, "gbk");
	int res;
	mysql_query(&my_connection, "use student");
	char query1[] = { "SELECT * FROM `message` where (`Grade`=\"" };
	char query2[] = { "\" and `Class`='" };
	char query3[] = { "')" };
	char *ch = (LPSTR)(LPCTSTR)GradeName;
	char *classname = (LPSTR)(LPCTSTR)str;
	char query[200];
	sprintf(query, "%s%s%s%s%s", query1, ch, query2, classname, query3);

	res = mysql_query(&my_connection, query);
	MYSQL_RES *result = mysql_store_result(&my_connection);
	char** sql_row = mysql_fetch_row(result);

	for (StudentCount = 0;sql_row != NULL; StudentCount++)
	{

		CString str;
		str.Format(_T("%s"), sql_row[5]);
		NameTemp[StudentCount] = str;

		sql_row = mysql_fetch_row(result);
		//free(result);
	}
	if (StudentCount >= 1)
	{
		if (StudentCount <= 14)
		{
			for (int f = 0;f <= i;f++)
			{
				CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + f);
				DlgHwnd->SetWindowText(NameTemp[f]);
				DlgHwnd->ShowWindow(SW_SHOW);
				
			}
		}
		else
		{
			for (int f = 0;f <= 13;f++)
			{
				CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + f);
				DlgHwnd->SetWindowText(NameTemp[f]);
				DlgHwnd->ShowWindow(SW_SHOW);
				
			}
			CString str;
			str.Format(_T("下一页"));
			CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON16);
			DlgHwnd->SetWindowText(str);
			DlgHwnd->ShowWindow(SW_SHOW);
			
			Page = 0;
		}
	}
	DataGuide = 2;
}
Пример #9
0
void CManageMySQL::GetClass(CString str)
{
	GradeName = str;
	for (int i = GradeCount;i >= 0;i--)
	{
		CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + i);
		DlgHwnd->SetWindowText(_T(""));
		DlgHwnd->ShowWindow(SW_HIDE);
		
	}//隐藏Button


	mysql_set_character_set(&my_connection, "gbk");
	int res;
	mysql_query(&my_connection, "use student");
	char query1[200] = { "SELECT * FROM `index` where (`Session`=\"" };
	char query2[200] = { "\")" };
	char *ch = (LPSTR)(LPCTSTR)str;
	char query[200];
	sprintf(query, "%s%s%s", query1, ch, query2);

	res = mysql_query(&my_connection, query);
	MYSQL_RES *result = mysql_store_result(&my_connection);
	char** sql_row = mysql_fetch_row(result);
	CString strc;
	strc.Format(_T("%s"), sql_row[1]);
	int i = _ttoi(strc);
	if (i >= 1)
	{
		if (i <= 14)
		{
			for (int f = 0;f <= i;f++)
			{
				CString str;
				str.Format(_T("%d班"), f + 1);
				CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + f);
				DlgHwnd->SetWindowText(str);
				DlgHwnd->ShowWindow(SW_SHOW);
				
			}
		}
		else
		{
			for (int f = 0;f <= 13;f++)
			{
				CString str;
				str.Format(_T("%d班"), f + 1);
				CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + f);
				DlgHwnd->SetWindowText(str);
				DlgHwnd->ShowWindow(SW_SHOW);
				
			}
			CString str;
			str.Format(_T("下一页"));
			CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON16);
			DlgHwnd->SetWindowText(str);
			DlgHwnd->ShowWindow(SW_SHOW);
			
			Page = 0;
			AllPageThings = i;
		}
	}
	DataGuide = 1;
}
Пример #10
0
void CTxMsgWndJ1939::vSetStatusBarText(const char* pacText)
{
    CWnd* pWnd = GetDlgItem(IDC_STATUSBAR);
    pWnd->SetWindowText(pacText);
}
Пример #11
0
void CManageMySQL::OnBnClickedButton16()
{
	// TODO: 在此添加控件通知处理程序代码
	if (DataGuide == 1)
	{
		for (int i = 13;i >= 0;i--)
		{
			GetDlgItem(IDC_BUTTON1 + i)->SetWindowTextA(_T(""));
			GetDlgItem(IDC_BUTTON1 + i)->ShowWindow(SW_HIDE);
		}//隐藏Button
		Page++;
		int i = AllPageThings - (Page * 14);
		if (i <= 14)
		{
			for (int f = 0;f <= i - 1;f++)
			{
				CString str;
				str.Format(_T("%d班"), f + Page * 14 + 1);
				GetDlgItem(IDC_BUTTON1 + f)->SetWindowTextA(str);
				GetDlgItem(IDC_BUTTON1 + f)->ShowWindow(SW_SHOW);
			}
			CString str;
			str.Format(_T("上一页"));
			GetDlgItem(IDC_BUTTON15)->SetWindowTextA(str);
			GetDlgItem(IDC_BUTTON15)->ShowWindow(SW_SHOW);
			str.Format(_T(""));
			GetDlgItem(IDC_BUTTON16)->SetWindowTextA(str);
			GetDlgItem(IDC_BUTTON16)->ShowWindow(SW_HIDE);
		}
		else
		{
			for (int f = 0;f <= 13;f++)
			{
				CString str;
				str.Format(_T("%d班"), f + Page * 14 + 1);
				GetDlgItem(IDC_BUTTON1 + f)->SetWindowTextA(str);
				GetDlgItem(IDC_BUTTON1 + f)->ShowWindow(SW_SHOW);
			}
			CString str;
			str.Format(_T("下一页"));
			GetDlgItem(IDC_BUTTON16)->SetWindowTextA(str);
			GetDlgItem(IDC_BUTTON16)->ShowWindow(SW_SHOW);
			str.Format(_T("上一页"));
			GetDlgItem(IDC_BUTTON15)->SetWindowTextA(str);
			GetDlgItem(IDC_BUTTON15)->ShowWindow(SW_SHOW);
		}
	}
	else if (DataGuide == 2)
	{
		for (int i = 13;i >= 0;i--)
		{
			GetDlgItem(IDC_BUTTON1 + i)->SetWindowTextA(_T(""));
			GetDlgItem(IDC_BUTTON1 + i)->ShowWindow(SW_HIDE);
		}//隐藏Button.
		Page++;
		int i = StudentCount - (Page * 14);
		if (i <= 14)
		{
			for (int f = 0;f <= i - 1;f++)
			{
				CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + f);
				DlgHwnd->SetWindowText(NameTemp[f + Page * 14]);
				DlgHwnd->ShowWindow(SW_SHOW);
				
			}
			CString str;
			str.Format(_T("上一页"));
			CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON15);
			DlgHwnd->SetWindowText(str);
			DlgHwnd->ShowWindow(SW_SHOW);
			DlgHwnd = GetDlgItem(IDC_BUTTON16);
			DlgHwnd->SetWindowText(_T(""));
			DlgHwnd->ShowWindow(SW_HIDE);
			
		}
		else
		{
			for (int f = 0;f <= 13;f++)
			{
				CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON1 + f);
				DlgHwnd->SetWindowText(NameTemp[f + Page * 14]);
				DlgHwnd->ShowWindow(SW_SHOW);
				
			}
			CString str;
			str.Format(_T("上一页"));
			CWnd* DlgHwnd = GetDlgItem(IDC_BUTTON15);
			DlgHwnd->SetWindowText(str);
			DlgHwnd->ShowWindow(SW_SHOW);
			
		}
	}
}//下一页
Пример #12
0
void CluckappDlg::OnPaint()
{
// 	CWnd *m_pDrawWnd = GetDlgItem(IDC_PIC1);
// 	CRect rect;
// 	m_pDrawWnd->GetClientRect(&rect);
// 	CDC* pDC = m_pDrawWnd->GetDC();
// 	CDC m_memDC;
// 	m_memDC.SelectObject(bmp[(nIndex++) % 3]);
// 	pDC->BitBlt(0, 0, rect.Width(), rect.Height(), &m_memDC, 0, 0, SRCCOPY);
// 	m_pDrawWnd->ReleaseDC(pDC);

// 

/*	CDialog::OnPaint();*/
	CPaintDC dc(this);
	CPaintDC *pDC=&dc;
	CDC MemDC1;
	CDC MemDC2;
	MemDC1.CreateCompatibleDC(NULL);
	MemDC2.CreateCompatibleDC(NULL);
	//加载位图
	CBitmap bitmap;
	BITMAP BMInfo;
	bitmap.LoadBitmap(IDB_BITMAP2);
	bitmap.GetBitmap(&BMInfo);
	//窗口大小
	CRect rect;
	GetClientRect(rect);
	MemDC1.SelectObject(&bitmap);
	//缩放到第二内存DC
	CBitmap Membitmap;
	Membitmap.CreateCompatibleBitmap(pDC,rect.Width(),rect.Height());
	MemDC2.SelectObject(&Membitmap);
	MemDC2.StretchBlt(0,0,rect.Width(),rect.Height(),&MemDC1,0,0,rect.Width(),rect.Height(),SRCCOPY);//BMInfo.bmWidth ,BMInfo.bmHeight,SRCCOPY);

	HBITMAP hOldbmp;// = (HBITMAP)
	if(runFlag==1)
	{
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				//GetRand(0,3)
				//hOldbmp = (HBITMAP)memDC.SelectObject(bmp[(nIndex[i*3+j]++) % 4+i]);
				hOldbmp = (HBITMAP)MemDC1.SelectObject(bmp[GetRand(0,44)]);// % 4+i
				MemDC2.StretchBlt(216+i*226,177+j*186,150,150,&MemDC1,0,0, 150, 150,SRCCOPY);//BMInfo.bmWidth ,BMInfo.bmHeight,SRCCOPY);//rect.Width(),rect.Height(),SRCCOPY);
			}
		}
	}
	else if(runFlag==2)
	{
		// 显示抽奖结果
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				hOldbmp = (HBITMAP)MemDC1.SelectObject(bmp[(nIndex%5)*9+i+3*j]);// % 4+i
				MemDC2.StretchBlt(216+i*226,177+j*186,150,150,&MemDC1,0,0, 150, 150,SRCCOPY);//BitBlt(216+i*226, 177+j*195, 150, 150, &memDC, 0, 0, SRCCOPY);//rc.Width(), rc.Height(), &memDC, 0, 0, SRCCOPY);
			}
		}
	}

	//MemDC2.TextOut(0,0,_T("我是固定文本"));


	//最后在屏幕显示再来
	//pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&MemDC2,0,0,BMInfo.bmWidth ,BMInfo.bmHeight,SRCCOPY);
	pDC->BitBlt(0,0,rect.Width(),rect.Height(),&MemDC2,0,0,SRCCOPY);
	//pDC->TextOut(100,100,_T("时间显示"));
	bitmap.DeleteObject();
	MemDC1.DeleteDC();
	MemDC2.DeleteDC();
	Membitmap.DeleteObject();
// 
 	CString strText="抽奖结果,拭目以待!";
// 	int testset=ResultNum.GetCount();
	if(runFlag==2)
	{

		CWnd* pWnd;
		pWnd = GetDlgItem(IDC_RESULT1);
		strText=luckapp->ResultNum.GetAt(0+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT2);
		strText=luckapp->ResultNum.GetAt(1+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT3);
		strText=luckapp->ResultNum.GetAt(2+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT4);
		strText=luckapp->ResultNum.GetAt(3+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT5);
		strText=luckapp->ResultNum.GetAt(4+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT6);
		strText=luckapp->ResultNum.GetAt(5+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT7);
		strText=luckapp->ResultNum.GetAt(6+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT8);
		strText=luckapp->ResultNum.GetAt(7+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT9);
		int testrrrr= 8+nIndex%5*9;
		strText=luckapp->ResultNum.GetAt(8+nIndex%5*9).Mid(7);
		pWnd->SetWindowText(strText);
	}else
	{
		strText.Format("请开始第%d/5轮抽奖", nIndex%5+1);
		CWnd* pWnd;
		pWnd = GetDlgItem(IDC_RESULT1);

		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT2);

		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT3);

		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT4);

		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT5);

		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT6);

		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT7);

		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT8);
		pWnd->SetWindowText(strText);

		pWnd = GetDlgItem(IDC_RESULT9);

		pWnd->SetWindowText(strText);
	}

}
Пример #13
0
BOOL CTLSentenceDlg::OnInitDialog() 
{
	CString T,strFontName;
	CHARFORMAT2 cf;
	CWnd* pWnd;

	CDialog::OnInitDialog();

	m_nSourceText=m_pDoc->m_nSourceText;
	CWnd* pDlg=this;
	if (m_nType==2)             //showing the target verse and the english for where a rule applied
	{
		T=L"";
	}
	else if (m_nType==3)        //entering an expression and gloss for Vocabulary Quizzer
	{
		T=L"Enter an expression and its gloss";
	}
	else if (m_nType==4)       //if editing a saved target verse
	{
		T=L"Edit the Target Text";
	}
	else if (m_nType==5)       //if displaying the English and target text from the Word doc
	{
		T=L"English and Target Texts from the Word document";
	}
	else if (m_nSourceText>2 && m_nSourceText!=5)        //if an English source text
	{
		if (m_nSourceText==3) T=L"Enter a proposition and its gloss for this English Missions Document verse."; 
		else if (m_nSourceText==4) T=L"Enter the text and its gloss for this English Bible verse.";
		else if (m_nSourceText==6) T=L"Enter a proposition and its gloss for this English Grammar Introduction verse."; 
		else if (m_nSourceText==7) T=L"Enter the text and its gloss for this English Document verse.";
	}
	pDlg->SetWindowText(T);
	//set up the edit control that will display the target text
	CRect rect1(9,32,740,165);
	m_recTarget.Create(ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | WS_VISIBLE | WS_BORDER, rect1, this, 1);
	if (m_nType==2 || m_nType==3 || m_nType==4 || m_nType==5 || m_nSourceText==5) strFontName=m_pDoc->GetTargetLanguageFontName();  //if TLText
	else strFontName=m_pDoc->GetSourceLanguageFontName(m_nSourceText);      //else English Bible or English Grammar Introduction
	cf.dwMask=CFM_FACE | CFM_BOLD | CFM_SIZE; 
	wcscpy_s(cf.szFaceName,strFontName);    //target font used as default because its text extent is probably > extent of Arial
	cf.dwEffects=!CFE_BOLD;
	cf.yHeight=220;
	m_recTarget.SetDefaultCharFormat(cf);   //set default to target font
	if (m_nType==2 || m_nType==5)           //if showing a verse where a rule applied
	{
		pWnd=&m_recTarget;
		pWnd->SetWindowText(m_strTarget);
		pWnd=&m_butOK;
		pWnd->ShowWindow(SW_HIDE);
		if (m_nRedFontStart>-1) ChangeColorOfCharacters(m_nRedFontStart,m_nRedFontEnd);
	}
	else if (m_nType==4)                  //if editing the target text
	{
		pWnd=&m_recTarget;
		pWnd->SetWindowText(m_strTarget);
	}
	//set up the edit control that will display the gloss
	CRect rect(9,185,740,310);
	m_recGloss.Create(ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | WS_VISIBLE | WS_BORDER, rect, this, 1);
	wcscpy_s(cf.szFaceName,L"Arial");
	m_recGloss.SetDefaultCharFormat(cf);   //set default to Arial font
	pWnd=&m_recGloss;
	pWnd->SetWindowText(m_strGloss);
	//UpdateData(FALSE);       //if editing gloss for English Bible so m_strGloss loaded, send it to the edit control
	if (m_nType==2 || m_nType==5) pWnd=GetDlgItem(IDCANCEL);         //showing popup from rule's references
	else pWnd=&m_recTarget;
	pWnd->SetFocus();
	return FALSE;
//	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #14
0
void DlgURL::SetStatus(LPCTSTR message)
{
	CWnd* statwnd = GetDlgItem(IDC_STATUS);
	statwnd->SetWindowText(message);
}
Пример #15
0
void CWebcam_demoDlg::OnBnClickedBtnConnectWebcam()
{
	// TODO: Add your control notification handler code here
	mWebcamConnected = !mWebcamConnected;

	CWnd *pB = GetDlgItem(IDC_BTN_CONNECT_WEBCAM);

	if(mWebcamConnected){
		CString sCaption = "Disconnect";
	    //CString str(szTest[i]) ;
		pB->SetWindowText(sCaption);
		
		// Request ownership of the critical section.
		EnterCriticalSection(&CriticalSection); 

		this->KillTimer(TIMER_ID_CAP_CAMERA);
		//-------------------------
		int iSel=-1;
		iSel=m_ctrlDevice.GetCurSel();
	
		HWND thisHWND = m_ctrlCaptureIMG.GetSafeHwnd();
		HWND thisParentHWND = this->GetSafeHwnd();
	
		if(m_pVMRCap != NULL){
			delete m_pVMRCap;
		}
		m_pVMRCap = new CVMR_Capture();  // setup webcam
		m_pVMRCap->Init( iSel, /*NULL*/ thisHWND, &m_bmpCtrl.m_un32ImageWidth, &m_bmpCtrl.m_un32ImageHeight, thisParentHWND);
	    
		InitChart(3, m_bmpCtrl.m_un32ImageWidth);
		InitGL(m_bmpCtrl.m_un32ImageWidth, m_bmpCtrl.m_un32ImageHeight);
		
	
		m_bmpCtrl.InitBitmap32(m_bmpCtrl.m_un32ImageHeight, m_bmpCtrl.m_un32ImageWidth);
	
		m_bmpCtrl.Init_Video_MemDC();
		/////////////////////////////
	

		
		/////////////////////////////
			m_Chart_X.Corrdinate(2,2);
			m_Chart_X.SetChartTitle("Horizontal intensity profile");
			m_Chart_X.SetChartLabel("","Y");
			m_Chart_X.SetGridXYNumber(8,2);
			m_Chart_X.SetRange(0, m_bmpCtrl.m_un32ImageWidth, 0,255);
			m_Chart_X.SetAxisStyle(0);
			m_Chart_X.mpSerie[0].m_plotColor = RGB(255,0,0);
			m_Chart_X.mpSerie[1].m_plotColor = RGB(0,255,0);
			m_Chart_X.mpSerie[2].m_plotColor = RGB(0,0,255);
			m_Chart_X.m_BGColor = RGB(255,255,255);
			m_Chart_X.SetGridXYNumber(20,15);
			m_Chart_X.UpdateWindow() ;// .Create(WS_CHILD|WS_VISIBLE,brect_2D_Chart,this,IDC_CHART_X);		
		
			/*
			unsigned char **img;
			img=new unsigned char *[m_bmpCtrl.m_un32ImageHeight];
		
			for(int i=0;i<m_bmpCtrl.m_un32ImageHeight;i++)
				img[i]=new unsigned char [m_bmpCtrl.m_un32ImageWidth];
		
			for(int i=0;i<m_bmpCtrl.m_un32ImageHeight;i++){
				for(int j=0;j<m_bmpCtrl.m_un32ImageWidth;j++){
					img[i][j]=  200;
				}
			}
			m_bmpCtrl.SetBitmap8(m_bmpCtrl.m_un32ImageHeight, m_bmpCtrl.m_un32ImageWidth, img);
			for(int  i=0;i<m_bmpCtrl.m_un32ImageHeight;i++)
				delete [] img[i];
			delete [] img;
			*/
		/////////////////////////////
		this->SetTimer (TIMER_ID_CAP_CAMERA,TIMER_DELAY_CAP_CAMERA,NULL);	
	    
		// Release ownership of the critical section.
		LeaveCriticalSection(&CriticalSection);

		//this->GetDlgItem(IDC_STARTCAP)->EnableWindow(TRUE);
		//this->GetDlgItem(IDC_BTN_CAP_WEBCAM)->EnableWindow(TRUE);
		//this->GetDlgItem(IDC_INITCAM)->EnableWindow(FALSE);	
	


	}else{
		CString sCaption = "Connect";
	    //CString str(szTest[i]) ;
		pB->SetWindowText(sCaption);

		if(m_pVMRCap){
			delete m_pVMRCap;
			m_pVMRCap = NULL;
//			m_pVMRCap = new CVMR_Capture();  // setup webcam
			int iSel=-1;
			iSel=m_ctrlDevice.GetCurSel();
			
//			HWND thisHWND = m_ctrlCaptureIMG.GetSafeHwnd();
//			HWND thisParentHWND = this->GetSafeHwnd();
//			m_pVMRCap->Init( iSel, /*NULL*/ thisHWND, &m_bmpCtrl.m_un32ImageWidth, &m_bmpCtrl.m_un32ImageHeight, thisParentHWND);

		}

		this->KillTimer(TIMER_ID_CAP_CAMERA);

		/**********************************************/
		// Select Camera in the combo box
		/**********************************************/	
//		this->GetDlgItem(IDC_BTN_CONNECT_WEBCAM) ->EnableWindow(FALSE);
	
//		if(m_pVMRCap->EnumDevices( m_ctrlDevice.m_hWnd )>0){
//			m_ctrlDevice.SetCurSel (0);
//			this->GetDlgItem (IDC_BTN_CONNECT_WEBCAM)->EnableWindow(TRUE);
//		}	
	

	}
}
Пример #16
0
BOOL CLoungeDlg::OnCommand(WPARAM wParam, LPARAM lParam) 
{
  BOOL rc = FALSE;
  UINT cmd = LOWORD(wParam);

  if (cmd >= IDC_LD_BUTTONIDBASE &&
      cmd < IDC_LD_BUTTONIDBASE + buttons_.size())
  {
    CWnd* pBtn = GetDlgItem(cmd);
    if (pBtn)
    {
      CString s;
      pBtn->GetWindowText(s);
      if (s == g_szAddToQueue)
      {
        joinOrRemoveQueue(cmd - IDC_LD_BUTTONIDBASE, TRUE);
        pBtn->SetWindowText(g_szRemoveFromQueue);
      }
      else
      {
        joinOrRemoveQueue(cmd - IDC_LD_BUTTONIDBASE, FALSE);
        pBtn->SetWindowText(g_szAddToQueue);
      }
    }
    
    rc = TRUE;
  }
  else
  {
    switch (cmd)
    {    
    case ID_LOGIN:
      doLogin();
      rc = TRUE;
      break;

    case ID_LOGOUT:
      doLogout();
      rc = TRUE;
      break;
  
    case ID_PDURECEIVED:
      handlePDU(reinterpret_cast<Network::PDUHeader*>(lParam));
      rc = TRUE;
      break;

    case ID_SHOW_SPLASH:
    {
      rc = TRUE;
      if (!CSplashWnd::ShowSplashScreen("splash_lounge.jpg",
                                        TRUE, // post login when close
                                        TRUE, // close on timer
                                        this))
      {
        if (AfxGetMainWnd())
          AfxGetMainWnd()->PostMessage(WM_COMMAND,
                                       MAKEWPARAM(ID_LOGIN, 0),
                                       0);
      }
    }

    default:
      break;
    }
  }

  if (!rc)
    rc = CDialog::OnCommand(wParam, lParam);

  return rc;
}
Пример #17
0
BOOL CPhoneticFeaturesDlg::OnInitDialog() 
{
	int i,j,nRowHeight,nLength,nNumberOfCharacters,nFontSize;
	CString T,strSequence, strIgnoredCharacters, strFontName;
	BOOL b;
	IDispatch* pTFontDisp;
	CWnd* pWnd;
	CDC* pDC;

	CDialog::OnInitDialog();
	
	nRowHeight=m_pDoc->GetTargetRowHeight();
	m_datatblPhoneticFeatures.GetRowSet().SetHeight((float)nRowHeight);
	m_nUnicodeFont=m_pDoc->m_nUnicodeFont;
	nLength=2;                //assume non-Unicode
//	if (m_nUnicodeFont>0) nLength=2;
	m_datatblPhoneticFeatures.GetColumnSet().GetItem(0).SetDataType(dttString);
	m_datatblPhoneticFeatures.GetColumnSet().GetItem(0).SetDataLen(nLength);
	m_datatblPhoneticFeatures.GetColumnSet().GetItem(0).SetDataEdit(editProtected);
	pTFontDisp=m_pDoc->GetPointerToTargetLanguageFont();
	m_datatblPhoneticFeatures.GetColumnSet().GetItem(0).SetFont(pTFontDisp);
	strFontName=m_pDoc->GetTargetLanguageFontName();
	nFontSize=m_pDoc->GetTargetLanguageFontSize();
	pDC=m_datatblPhoneticFeatures.GetDC();
	m_fontTarget.DeleteObject();
	b=m_fontTarget.CreatePointFont(nFontSize*10,strFontName,pDC); //create the font for OnPaintCell
	if (m_nType==1)           //if displaying phonetic features
	{
		pWnd=GetDlgItem(IDC_STATICSENTENCEFINALCHARACTERS);
		pWnd->ShowWindow(SW_HIDE);
	}
	else                      //else displaying capital letters
	{
		pWnd=this;
		pWnd->SetWindowText(L"Capital Letters");
		pWnd=GetDlgItem(IDC_BUTTONEDIT);
		pWnd->ShowWindow(SW_HIDE);
		pWnd=GetDlgItem(IDC_BUTTONNEWFEATURE);
		pWnd->ShowWindow(SW_HIDE);
		CRect rect(247,355,400,380);
		m_recSentenceFinalCharacters.Create(ES_AUTOHSCROLL | WS_VISIBLE | WS_BORDER | WS_TABSTOP, rect, this, 1);
		strFontName=m_pDoc->m_strTargetLanguageFontName;
		CHARFORMAT2 cf;
//		wcscpy_s(szFontName,strFontName);  
		memset(&cf, 0, sizeof(CHARFORMAT2));
		wcscpy_s(cf.szFaceName,strFontName);
		cf.dwMask = CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_BOLD;
		cf.bCharSet = DEFAULT_CHARSET;
		cf.yHeight = 200;
		cf.bPitchAndFamily = VARIABLE_PITCH | FF_DONTCARE;
		cf.dwEffects = !CFE_BOLD;
		m_recSentenceFinalCharacters.SetDefaultCharFormat(cf);
		m_strSentenceFinalCharacters=m_pDoc->m_strSentenceFinalCharacters;
		m_recSentenceFinalCharacters.SetSel(0,-1);   //delete the previous text
		m_recSentenceFinalCharacters.SetWindowText(m_strSentenceFinalCharacters);
	}
//	m_nOffset=0;
//	T=m_pDoc->m_starCharacters[0];      //check if the first character is a space
//	if (T.Left(1)==L" ") m_nOffset=1;       //used for row labels because the first row is hidden because it contains a space
	DisplayCharacters();
	if (m_strCharacter!=L"")     //if setting the features for a particular character
	{
		CWnd* pDlg=this;
		T=L"Specify the features for this new character";
		pDlg->SetWindowText(T);
		nNumberOfCharacters=m_pDoc->m_nCharacters;
		for (i=0,j=0;i<nNumberOfCharacters && j==0;i++) 
		{
			T=m_pDoc->m_starCharacters[i];
			if (T==m_strCharacter)
			{
				if (i>0) j=i-1;
				else j=0;
				m_datatblPhoneticFeatures.GetRowSet().SetFirstVisible(paneTop,j); //make second row if possible
				m_datatblPhoneticFeatures.GetCellSet().GetItem(i-1,0).SetBackColor(RGB(0,255,64));
				j=1;   //end search
			}
		}
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #18
0
BOOL CSettingsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  hier zusätzliche Initialisierung hinzufügen.
	m_ctrlDifficultySlider.SetRange(0,4);
	m_ctrlDifficultySlider.SetTicFreq(1);
	m_ctrlMusicvolume.SetRange(0,100);
	m_ctrlMusicvolume.SetTicFreq(1);
	m_ctrlTooltipDelay.SetRange(0,2000);
	m_ctrlTooltipDelay.SetTicFreq(50);
	m_ctrlStarDensity.SetRange(0,100);
	m_ctrlStarDensity.SetTicFreq(1);
	m_ctrlMinorDensity.SetRange(0,100);
	m_ctrlMinorDensity.SetTicFreq(1);
	m_ctrlAnomalyDensity.SetRange(0,100);
	m_ctrlAnomalyDensity.SetTicFreq(1);

	CIniLoader* pIni = CIniLoader::GetInstance();
	ASSERT(pIni);

	// General
	bool bAutosave = true;
	if (!pIni->ReadValue("General", "AUTOSAVE", bAutosave))
		ASSERT(false);
	m_bAutoave = bAutosave;

	if (!pIni->ReadValue("General", "DIFFICULTY", m_sDifficulty))
		ASSERT(false);
	m_sDifficulty.MakeUpper();
	if (m_sDifficulty == "BABY")
		m_ctrlDifficultySlider.SetPos(0);
	else if (m_sDifficulty == "EASY")
		m_ctrlDifficultySlider.SetPos(1);
	else if (m_sDifficulty == "NORMAL")
		m_ctrlDifficultySlider.SetPos(2);
	else if (m_sDifficulty == "HARD")
		m_ctrlDifficultySlider.SetPos(3);
	else if (m_sDifficulty == "IMPOSSIBLE")
		m_ctrlDifficultySlider.SetPos(4);

	CWnd* pCtrl = GetDlgItem(IDC_STATIC_DIFFICULTY);
	if (pCtrl)
		pCtrl->SetWindowText(m_sDifficulty);

	//Galaxysize
	m_comboGalaxysize.AddString("TINY 15x10");
	m_comboGalaxysize.AddString("SMALL 20x15");
	m_comboGalaxysize.AddString("CLASSIC 30x20");
	m_comboGalaxysize.AddString("HUGE 40x30");
	m_comboGalaxysize.AddString("VERY HUGE 50x35");
	int sizeh=30,sizev=20;
	pIni->ReadValue("Special", "MAPSIZEH", sizeh);
	pIni->ReadValue("Special", "MAPSIZEV", sizev);
	if(sizeh==15&&sizev==10)
	{
		m_comboGalaxysize.SetCurSel(0);
	}
	else if(sizeh==20&&sizev==15)
	{
		m_comboGalaxysize.SetCurSel(1);
	}
	else if(sizeh==30&&sizev==20)
	{
		m_comboGalaxysize.SetCurSel(2);
	}
	else if(sizeh==40&&sizev==30)
	{
		m_comboGalaxysize.SetCurSel(3);
	}
	else if(sizeh==50&&sizev==35)
	{
		m_comboGalaxysize.SetCurSel(4);
	}
	else
	{
		CString s;
		s.Format("Custom %dx%d",sizeh,sizev);
		m_comboGalaxysize.AddString(s);
		m_comboGalaxysize.SetCurSel(3);
	}

	//Galaxyshape
	m_comboGalaxyshape.AddString("irregular");
	m_comboGalaxyshape.AddString("elliptic");
	m_comboGalaxyshape.AddString("spiral");
	m_comboGalaxyshape.AddString("ring");
	m_comboGalaxyshape.AddString("lenticular");
	m_comboGalaxyshape.AddString("islands");
    int genMode=0;
	pIni->ReadValue("Special", "GENERATIONMODE", genMode);
	m_comboGalaxyshape.SetCurSel(genMode);




	// Audio
	bool bHardwareSound = true;
	if (!pIni->ReadValue("Audio", "HARDWARESOUND", bHardwareSound))
		ASSERT(false);
	m_bHardwaresound = bHardwareSound;

	bool bSound = true;
	if (!pIni->ReadValue("Audio", "SOUND", bSound))
		ASSERT(false);
	m_bSound = bSound;

	bool bMusic = true;
	if (!pIni->ReadValue("Audio", "MUSIC", bMusic))
		ASSERT(false);
	m_bMusic = bMusic;

	float fMusicVolume = 0.3f;
	if (!pIni->ReadValue("Audio", "MUSICVOLUME", fMusicVolume))
		ASSERT(false);
	m_ctrlMusicvolume.SetPos(fMusicVolume * 100);

	// Video
	bool bShowTraderoutes = true;
	if (!pIni->ReadValue("Video", "SHOWTRADEROUTES", bShowTraderoutes))
		ASSERT(false);
	m_bShowTraderoutes = bShowTraderoutes;

	bool bAnimatedIcon = true;
	if (!pIni->ReadValue("Video", "ANIMATEDICON", bAnimatedIcon))
		ASSERT(false);
	m_bAnimatedIcon = bAnimatedIcon;

	bool bShowMiniMap = true;
	if (!pIni->ReadValue("Video", "SHOWMINIMAP", bShowMiniMap))
		ASSERT(false);
	m_bShowMiniMap = bShowMiniMap;

	bool bShowRandomEventPictures = true;
	if (!pIni->ReadValue("Video", "SHOWRANDOMEVENTPICTURES", bShowRandomEventPictures))
		ASSERT(false);
	m_bShowRandomEventPictures = bShowRandomEventPictures;

	int nTooltipDelay = 750;
	if (!pIni->ReadValue("Video", "TOOLTIPDELAY", nTooltipDelay))
		ASSERT(false);
	m_ctrlTooltipDelay.SetPos(nTooltipDelay);

	// Control
	bool bShowScrollbars = false;
	if (!pIni->ReadValue("Control", "SHOWSCROLLBARS", bShowScrollbars))
		ASSERT(false);
	m_bShowScrollBars = bShowScrollbars;

	bool bInvertMouse = false;
	if (!pIni->ReadValue("Control", "INVERTMOUSE", bInvertMouse))
		ASSERT(false);
	m_bInvertMouse = bInvertMouse;

	bool bHideMenu = false;
	if (!pIni->ReadValue("Control", "HIDEMENUBAR", bHideMenu))
		ASSERT(false);
	m_bHideMenu = bHideMenu;

	// Special (Ingame)
	int nRandomSeed = -1;
	if (!pIni->ReadValue("Special", "RANDOMSEED", nRandomSeed))
		ASSERT(false);
	if (nRandomSeed < -1)
		nRandomSeed = -1;
	CString sRandomSeed;
	sRandomSeed.Format("%d", nRandomSeed);
	m_edtRandomSeed.SetWindowText(sRandomSeed);

	//researchspeed 
	//if (!pIni->ReadValue("Special", "RESEARCHSPEED", nStarDensity))
	//	ASSERT(false);

	int nStarDensity = 35;
	if (!pIni->ReadValue("Special", "STARDENSITY", nStarDensity))
		ASSERT(false);
	m_ctrlStarDensity.SetPos(nStarDensity);

	int nMinorDensity = 30;
	if (!pIni->ReadValue("Special", "MINORDENSITY", nMinorDensity))
		ASSERT(false);
	m_ctrlMinorDensity.SetPos(nMinorDensity);

	int nAnomalyDensity = 9;
	if (!pIni->ReadValue("Special", "ANOMALYDENSITY", nAnomalyDensity))
		ASSERT(false);
	m_ctrlAnomalyDensity.SetPos(nAnomalyDensity);

	bool bAlienEntities = true;
	if (!pIni->ReadValue("Special", "ALIENENTITIES", bAlienEntities))
		ASSERT(false);
	m_bAlienEntities = bAlienEntities;

	bool bRandomEvents = true;
	if (!pIni->ReadValue("Special", "RANDOMEVENTS", bRandomEvents))
		ASSERT(false);
	m_bRandomEvents = bRandomEvents;

	// Victory Conditions
	bool bVCElimination = true;
	if (!pIni->ReadValue("Victory_Conditions", "Elimination", bVCElimination))
		ASSERT(false);
	m_bVCElimination = bVCElimination;

	bool bVCDiplomacy = false;
	if (!pIni->ReadValue("Victory_Conditions", "Diplomacy", bVCDiplomacy))
		ASSERT(false);
	m_bVCDiplomacy = bVCDiplomacy;

	bool bVCConquest = false;
	if (!pIni->ReadValue("Victory_Conditions", "Conquest", bVCConquest))
		ASSERT(false);
	m_bVCConquest = bVCConquest;

	bool bVCResearch = false;
	if (!pIni->ReadValue("Victory_Conditions", "Research", bVCResearch))
		ASSERT(false);
	m_bVCResearch = bVCResearch;

	bool bVCCombat = false;
	if (!pIni->ReadValue("Victory_Conditions", "Combat", bVCCombat))
		ASSERT(false);
	m_bVCCombat = bVCCombat;

	bool bVCSabotage = false;
	if (!pIni->ReadValue("Victory_Conditions", "Sabotage", bVCSabotage))
		ASSERT(false);
	m_bVCSabotage = bVCSabotage;

	// alle nicht während des Spiels änderbaren Einstellungen deaktivieren
	if (m_bDisable)
	{
		CWnd* pWnd = GetDlgItem(IDC_SLIDER_STARDENSITY);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_SLIDER_MINORDENSITY);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_SLIDER_ANOMALYDENSITY);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_CHECK_VC_ELIMINATION);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_CHECK_VC_DIPLOMACY);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_CHECK_VC_CONQUEST);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_CHECK_VC_RESEARCH);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_CHECK_VC_COMBAT);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_CHECK_VC_SABOTAGE);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_COMBOGALAXYSIZE);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_COMBOGALAXYSHAPE);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_EDIT_RANDOMSEED);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_CHECK_ALIENENTITIES);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
		pWnd = GetDlgItem(IDC_CHECK_RANDOMEVENTS);
		if (pWnd)
			pWnd->EnableWindow(FALSE);
	}

	UpdateData(false);

	return TRUE;  // return TRUE unless you set the focus to a control
	// AUSNAHME: OCX-Eigenschaftenseite muss FALSE zurückgeben.
}
void CRunMapExpertDlg::OnSelchangeCommandlist() 
{
	int iIndex = -1;

	// change the selection in the command list - update the command
	//  and parameters edit boxes
	PCCOMMAND pCommand = GetCommandAtIndex(&iIndex);
	
	// enable/disable controls
	BOOL bEnable = pCommand ? TRUE : FALSE;
	int iEnableCmds[] =
	{
		// edit fields:
		IDC_COMMAND,
		IDC_PARAMETERS,
		IDC_ENSUREFN,

		// checkboxes/buttons:
		IDC_ENSURECHECK,
		IDC_USEPROCESSWND,
		IDC_INSERTPARM,
		IDC_BROWSECOMMAND,

		-1
	};

	m_bNoUpdateCmd = TRUE;
	for(int i = 0; iEnableCmds[i] != -1; i++)
	{
		CWnd *pWnd = GetDlgItem(iEnableCmds[i]);
		pWnd->EnableWindow(bEnable);
		if(bEnable == FALSE)
		{
		// ensure fields are cleared if we're disabling them
			if(i < 3)
				pWnd->SetWindowText("");
			else
				((CButton*)pWnd)->SetCheck(0);
		}
	}
	m_bNoUpdateCmd = FALSE;

	if(!pCommand)
		return;

	// set moveup/movedown buttons
	m_cMoveUp.EnableWindow(iIndex != 0);
	m_cMoveDown.EnableWindow(iIndex != m_cCommandList.GetCount() - 1);
	
	m_bNoUpdateCmd = TRUE;

	m_cCommand.SetWindowText(GetCmdString(pCommand));
	m_cParameters.SetWindowText(pCommand->szParms);
	m_cEnsureCheck.SetCheck(pCommand->bEnsureCheck);
	m_cEnsureFn.SetWindowText(pCommand->szEnsureFn);		
	m_cUseProcessWnd.SetCheck(pCommand->bUseProcessWnd);
	// don't forget to call this:
		OnEnsurecheck();

	m_bNoUpdateCmd = FALSE;
}
Пример #20
0
BOOL CFilesHashDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	// TODO:在此添加额外的初始化代码
	InitializeCriticalSection(&g_criticalSection);

	m_bruEditBkg.CreateSolidBrush(RGB(255, 255, 255));

	PrepareAdvTaskbar();

	m_bFind = FALSE;
	m_btnClr.SetWindowText(MAINDLG_CLEAR);

	m_hWorkThread = NULL;
	m_waitingExit = FALSE;

	m_calculateTime = 0.0;
	m_timer = -1;

	m_prog.SetStep(1);

	m_bLimited = IsLimitedProc();

	CWnd* pWnd;
	pWnd = GetDlgItem(IDC_STATIC_SPEED);
	pWnd->SetWindowText(_T(""));
	pWnd = GetDlgItem(IDC_STATIC_TIME);
	pWnd->SetWindowText(_T(""));
	pWnd = GetDlgItem(IDC_STATIC_FILE);
	pWnd->SetWindowText(MAINDLG_FILE_PROGRESS);
	pWnd = GetDlgItem(IDC_STATIC_WHOLE);
	pWnd->SetWindowText(MAINDLG_TOTAL_PROGRESS);
	pWnd = GetDlgItem(IDC_STATIC_UPPER);
	pWnd->SetWindowText(MAINDLG_UPPER_HASH);
	pWnd = GetDlgItem(IDC_STATIC_UPPER);
	pWnd->SetWindowText(MAINDLG_UPPER_HASH);
	pWnd = GetDlgItem(IDC_STATIC_TIMETITLE);
	pWnd->SetWindowText(MAINDLG_TIME_TITLE);

	m_btnOpen.SetWindowText(MAINDLG_OPEN);
	m_btnStop.SetWindowText(MAINDLG_STOP);
	m_btnCopy.SetWindowText(MAINDLG_COPY);
	m_btnFind.SetWindowText(MAINDLG_VERIFY);
	m_btnExit.SetWindowText(MAINDLG_EXIT);
	pWnd = GetDlgItem(IDC_ABOUT);
	pWnd->SetWindowText(MAINDLG_ABOUT);
	

	EnterCriticalSection(&g_criticalSection);
	{
		m_thrdData.hWnd = m_hWnd;
		m_thrdData.uppercase = FALSE;

		m_thrdData.nFiles = 0;

		m_thrdData.strAll = _T("");
		m_thrdData.resultList.clear();
	}
	LeaveCriticalSection(&g_criticalSection);
	
	pTl = NULL;

	m_editMain.SetLimitText(UINT_MAX);
	m_editMain.SetWindowText(MAINDLG_INITINFO);

	if(ContextMenuExisted())
	{
		// 已经添加右键菜单
		m_btnContext.SetWindowText(MAINDLG_REMOVE_CONTEXT_MENU);
	}
	else
	{
		m_btnContext.SetWindowText(MAINDLG_ADD_CONTEXT_MENU);
	}
	pWnd = (CStatic*)GetDlgItem(IDC_STATIC_ADDRESULT);
	pWnd->SetWindowText(_T(""));

	SetCtrls(FALSE);

	// 从命令行获取文件路径
	CStrVector Paras = ParseCmdLine();
	ClearFilePaths();
	for(CStrVector::iterator ite = Paras.begin(); ite != Paras.end(); ++ite)
	{
		m_thrdData.fullPaths.push_back(*ite);
		++m_thrdData.nFiles;
	}
	// 从命令行获取文件路径结束
	
	m_thrdData.threadWorking = FALSE;
	m_prog.SetRange(0, 99);
	m_progWhole.SetRange(0, 99);
	m_chkUppercase.SetCheck(0);

	if(m_thrdData.nFiles > 0)
		SetTimer(4, 50, NULL); // 使 DoMD5() 在 OnInitDialog() 之后执行

	return TRUE;  // 除非设置了控件的焦点,否则返回 TRUE
}
Пример #21
0
LRESULT CTxMsgChildFrame::vUserCommand(WPARAM wParam, LPARAM lParam)
{

    if( m_pomTxMsgBlocksView != NULL &&
            m_pomTxMsgDetailsView != NULL &&
            m_pomTxMsgListView != NULL &&
            m_pomFunctionsView != NULL )
    {
        INT nBase              = 0;
        BOOL bTxON             = FALSE;
        BOOL bConnect          = FALSE;
        eUSERSELCTION eUserSel = eDATABASEIMPORTCMD;
        //CFlags * pouFlag       = NULL;

        eUserSel               = static_cast <eUSERSELCTION>(wParam);
        switch(eUserSel)
        {
            case eHEXDECCMD:
                //// Get the flag status.
                //pouFlag = pouGetFlagsPtr();
                //if ( pouFlag != NULL )
                //{
                //    nBase    = pouFlag->nGetFlagStatus( HEX );
                //}
                nBase = (INT)lParam;
                // Check if the flag is changed and if so,
                // change the display format.
                if(nBase != CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_HEX))
                {
                    CTxMsgManager::s_TxFlags.vSetFlagStatus(TX_HEX, nBase);
                    // Hide any edit controls if it is visible
                    m_pomTxMsgDetailsView->m_omLctrSigList.SetFocus();

                    if ( m_pomTxMsgBlocksView->m_psMsgBlockList != NULL )
                    {
                        PSMSGBLOCKLIST psMsgBlock =
                            m_pomTxMsgBlocksView->psGetMsgBlockPointer(
                                m_pomTxMsgBlocksView->m_nSelectedMsgBlockIndex,
                                m_pomTxMsgBlocksView->m_psMsgBlockList );
                        if(psMsgBlock != NULL)
                        {
                            m_pomTxMsgListView->
                            m_omLctrMsgList.DeleteAllItems();
                            m_pomTxMsgBlocksView->
                            vDisplayMsgBlockDetails(psMsgBlock);
                        }
                    }
                    m_pomTxMsgBlocksView->vSetControlProperties();
                    m_pomTxMsgDetailsView->vSetControlProperties();
                    // Clear the controls after changing the properties.
                    m_pomTxMsgDetailsView->vSetValues(NULL);
                    // Remove all entries in the list and disable
                    m_pomTxMsgDetailsView->vDisableSignalComponents();
                    // Disable Delete Button & Send Button as the focus is lost
                    m_pomTxMsgListView->
                    m_omButtonDeleteSelMsg.EnableWindow(FALSE);
                    m_pomTxMsgListView->
                    m_omButtonSendMsg.EnableWindow(FALSE);
                    m_pomTxMsgListView->m_nSelectedMsgIndex = -1;
                    // Set Lable to indicate Mode
                    CString omStrText = CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_HEX) ?
                                        _(defSTR_HEX_MODE) : _(defSTR_DEC_MODE);
                    CWnd* pomLabel =
                        m_pomTxMsgDetailsView->GetDlgItem(IDC_STAT_HEADER2);
                    if( pomLabel != NULL )
                    {
                        // Set the text with Hex/Dec mode
                        pomLabel->SetWindowText(omStrText);
                    }
                }
                break;
            case eTXMSGCMD:
                // Get the flag status.
                /*pouFlag = pouGetFlagsPtr();
                if(pouFlag != NULL )
                {
                    bTxON    =
                        static_cast<BOOL> (pouFlag->nGetFlagStatus( SENDMESG ));
                }*/
                bTxON = (BOOL)lParam;
                // If transmission is ON, user should not be able to
                // delete any message or block.
                if(bTxON != CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_SENDMESG))
                {
                    CTxMsgManager::s_TxFlags.vSetFlagStatus(TX_SENDMESG, bTxON);
                    // Get the message count and disable if
                    // there is some message list in the currently
                    // selected block.
                    if ( m_pomTxMsgBlocksView->m_psMsgBlockList != NULL )
                    {
                        PSMSGBLOCKLIST psMsgBlock =
                            m_pomTxMsgBlocksView->psGetMsgBlockPointer(
                                m_pomTxMsgBlocksView->m_nSelectedMsgBlockIndex,
                                m_pomTxMsgBlocksView->m_psMsgBlockList );

                        if(psMsgBlock != NULL)
                        {
                            if( psMsgBlock->m_unMsgCount > 0 )
                            {
                                m_pomTxMsgListView->m_omButtonDeleteAllMsg.
                                EnableWindow(!bTxON);
                            }
                        }
                        //If it is key triggered then Enable/Diable All Messages
                        //Check box and Key val edit box
                        if( IS_KEY_TRIGGERED (psMsgBlock->m_ucTrigger) )
                        {
                            /*m_pomTxMsgBlocksView->m_omButtonTxAllFrame.
                            EnableWindow(!bTxON);*/
                            m_pomTxMsgBlocksView->m_omComboAllMsgs.EnableWindow(!bTxON);
                            m_pomTxMsgBlocksView->m_omEditTrgKeyVal.
                            EnableWindow(!bTxON);
                        }

                        if(bTxON)
                        {
                            m_pomTxMsgBlocksView->m_omComboAllMsgs.EnableWindow(!bTxON);
                            m_pomTxMsgBlocksView->m_omEditTrgKeyVal.
                            EnableWindow(!bTxON);
                        }


                        //AUC
                        //only if DElay btn msg blocks check box is not checked den check time trigger button
                        if(((CButton*) m_pomTxMsgBlocksView->
                                GetDlgItem(IDC_CHECK_MSG_BLOCK_DELAY))->GetCheck() == BST_UNCHECKED)
                        {
                            m_pomTxMsgBlocksView->m_omButtonTimeTrigger.
                            EnableWindow(!bTxON);
                            // If it is time triggered then time interval edit box
                            if( IS_TIME_TRIGGERED (psMsgBlock->m_ucTrigger) )
                            {
                                m_pomTxMsgBlocksView->m_omEditTrgTimeIntervalVal.
                                EnableWindow(!bTxON);
                            }
                        }
                        ((CButton*) m_pomTxMsgBlocksView->GetDlgItem(IDC_CHECK_MSG_BLOCK_DELAY))->EnableWindow(!bTxON);

                        if((((CButton*) m_pomTxMsgBlocksView->
                                GetDlgItem(IDC_CHECK_MSG_BLOCK_DELAY))->IsWindowEnabled() == TRUE)&&
                                ((CButton*) m_pomTxMsgBlocksView->
                                 GetDlgItem(IDC_CHECK_MSG_BLOCK_DELAY))->GetCheck() == BST_CHECKED)
                        {
                            ((CEdit*) m_pomTxMsgBlocksView->
                             GetDlgItem(IDC_EDIT_BLOCK_TRG_TIMER_VAL))->EnableWindow(TRUE);
                        }
                        else
                        {
                            ((CEdit*) m_pomTxMsgBlocksView->
                             GetDlgItem(IDC_EDIT_BLOCK_TRG_TIMER_VAL))->EnableWindow(FALSE);
                        }
                        m_pomTxMsgBlocksView->m_omButtonKeyTrigger.
                        EnableWindow(!bTxON);
                        CButton* pRadioMonoshot = (CButton*)m_pomTxMsgBlocksView->GetDlgItem(IDC_RADIOMONOSHOT);
                        CButton* pRadioCyclic = (CButton*)m_pomTxMsgBlocksView->GetDlgItem(IDC_RADIOCYCLIC);
                        if ((pRadioMonoshot != NULL) && (pRadioCyclic != NULL))
                        {
                            pRadioMonoshot->EnableWindow(!bTxON);
                            pRadioCyclic->EnableWindow(!bTxON);
                        }
                        m_pomTxMsgBlocksView->m_omButtonAddMsgBlock.EnableWindow(!bTxON);
                        m_pomTxMsgBlocksView->m_omEditMsgBlockName.EnableWindow(!bTxON);
                        /*m_pomTxMsgBlocksView->m_omButtonTriggerType.
                                                        EnableWindow(!bTxON);*/
                    }

                    if( m_pomTxMsgListView->m_nSelectedMsgIndex != -1 )
                    {
                        m_pomTxMsgListView->m_omButtonDeleteSelMsg.
                        EnableWindow(!bTxON);
                    }
                    if(m_pomTxMsgBlocksView->m_nSelectedMsgBlockIndex !=
                            -1 )
                    {
                        m_pomTxMsgBlocksView->m_omButtonDeleteMsgBlock.
                        EnableWindow(!bTxON);
                    }

                    // Set the focus to the block list control if transmission is started
                    // to capture the key events
                    if (bTxON)
                    {
                        m_pomTxMsgBlocksView->m_omLctrMsgBlockName.SetFocus();
                    }
                }
                break;
            case eCONNECTCMD:
                // Get the flag status.
                /*pouFlag = pouGetFlagsPtr();
                if(pouFlag != NULL )
                {
                    bConnect = static_cast<BOOL>
                                  (pouFlag->nGetFlagStatus( CONNECTED ));
                }*/
                bConnect = (BOOL)lParam;
                // If the tool is disconnected, user should not be able
                // send any message.

                if(bConnect != CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_CONNECTED))
                {
                    if( m_pomTxMsgListView->m_nSelectedMsgIndex != -1 )
                    {
                        m_pomTxMsgListView->m_omButtonSendMsg.
                        EnableWindow(bConnect);
                    }
                    else
                    {
                        m_pomTxMsgListView->m_omButtonSendMsg.
                        EnableWindow(FALSE);
                    }
                    CTxMsgManager::s_TxFlags.vSetFlagStatus(TX_CONNECTED, bConnect);
                }
                break;

            case eDATABASEIMPORTCMD:

                m_pomTxMsgDetailsView->m_omComboMsgIDorName.ResetContent();
                m_pomTxMsgDetailsView->vPopulateMessageComboBox();

                // The icon for database message may change to change the
                // display.
                if ( m_pomTxMsgBlocksView->m_psMsgBlockList != NULL )
                {
                    PSMSGBLOCKLIST psMsgBlock =
                        m_pomTxMsgBlocksView->psGetMsgBlockPointer(
                            m_pomTxMsgBlocksView->m_nSelectedMsgBlockIndex,
                            m_pomTxMsgBlocksView->m_psMsgBlockList );
                    if(psMsgBlock != NULL)
                    {
                        m_pomTxMsgListView->m_omLctrMsgList.DeleteAllItems();
                        m_pomTxMsgBlocksView->
                        vDisplayMsgBlockDetails(psMsgBlock);
                        m_pomTxMsgDetailsView->vUpdateAllBlocksFrmDB();
                        m_pomTxMsgBlocksView->AutoUpdateChanges();
                    }
                }
                m_pomTxMsgDetailsView->vSetValues(NULL);
                // Clear Signal Components
                m_pomTxMsgDetailsView->vDisableSignalComponents();
                // Disable Delete Button & Send Button as the focus is lost
                m_pomTxMsgListView->m_omButtonDeleteSelMsg.EnableWindow(FALSE);
                m_pomTxMsgListView->m_omButtonSendMsg.EnableWindow(FALSE);
                m_pomTxMsgListView->m_nSelectedMsgIndex = -1;
                break;

            case eCHANNELCOUNTUPDATED:
                m_pomTxMsgDetailsView->vUpdateChannelIDInfo();
                break;

            default:
                ASSERT( FALSE );
                break;
        }
    }

    return 0;
}
Пример #22
0
BOOL CSampleConfigDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	// 各控件初始化

	// “序号”组合框和“编号前缀”编辑框内容初始化
	m_ctrlCombSerials.InsertString(0,_T("数字(1、2、3)"));
	m_ctrlCombSerials.InsertString(1,_T("坐标(A1、B2)"));
	m_ctrlCombSerials.InsertString(2,_T("日期+数字"));
	m_ctrlCombSerials.SetCurSel(0);
	m_ctrlEditNumPrefix.SetWindowText(_T("样本"));

	// “样本类型”组合框内容初始化
	CSampleTable * pSampleTable = CSampleTable::GetInstance();
	vector<CString> TypeList;
	pSampleTable->GetDistinctType(TypeList);
	for(int i=0; i< (int) TypeList.size(); i++)
	{
		m_ctrlCombTypes.InsertString(i,TypeList[i]);
	}

	// “稀释倍数”编辑框初始化
	m_ctrlEditDilution.SetWindowText(_T("1"));

	// 检测项目组合框初始化
	CReagentTable * pReagentTable = CReagentTable::GetInstance();

	map<Reagent_Pos,const ReagentConfigNode *>::iterator iterReagent = m_RegentConfigNodes.begin();
	vector<CString> ProjectList;
	while(iterReagent != m_RegentConfigNodes.end())
	{
		// 取得该试剂ID的试剂详细信息
		ReagentRecord regentInfo;
		regentInfo = pReagentTable->GetRecordInfo(iterReagent->second->ReagentID);
		int nCountOfComboxItem = m_ctrlListProject.GetCount();

		// 在组合框末尾添加该试剂检测项目名称
		CString temp;
		temp.Format(_T("%d. %s"),iterReagent->first,regentInfo.ProjectName);
		m_ctrlListProject.InsertString(nCountOfComboxItem,temp);

		// 组合框该Item的数据指向试剂区位置
		m_ctrlListProject.SetItemData(nCountOfComboxItem,static_cast<DWORD_PTR>(iterReagent->second->pos));

		// 把项目名称保存下来,作为itemdata的组合框选项
		ProjectList.push_back(temp);
		iterReagent++;
	}

	// 初始一览表列属性
	m_ctrlConfigList.InsertColumn(0,_T("坐标"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(1,_T("样本编号"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(2,_T("样本类型"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(3,_T("稀释倍数"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(4,_T("送检单位名称"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(5,_T("送检人"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(6,_T("送检日期"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(7,_T("检测项目名称"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(8,_T("重复次数"),LVCFMT_CENTER);
	m_ctrlConfigList.InsertColumn(9,_T("理论浓度"),LVCFMT_CENTER);
	m_ctrlConfigList.SetItemHeight(24);
	
	m_ctrlConfigList.m_GridFrameColor = RGB(169,199,240);
	m_ctrlConfigList.m_SelectedBackColor = RGB(230, 241, 255);

	for(int i=0; i<m_ctrlConfigList.GetColumnCount(); i++)
	{
		m_ctrlConfigList.SetColumnWidth(i,LVSCW_AUTOSIZE_USEHEADER);
	}

	// 初始一览表数据
	map<Sample_Pos,SampleConfigNode *>::iterator iter = m_SampleConfigNodes.begin();
	int idxItem = 0;
	while(iter != m_SampleConfigNodes.end())
	{
		vector<CSampleConfigListItem *> vectItem;

		// 调用confignode类型数据转化为CSampleConfigListItem类型数据函数
		_ConfigToList(iter->second,vectItem);

		for(int i=0; i < (int)vectItem.size(); i++)
		{
			vectItem[i]->SetTypeOptions(TypeList);
			vectItem[i]->SetProjectOptions(ProjectList);
			m_mapListItemData.insert(pair<Sample_Pos,CSampleConfigListItem*>(vectItem[i]->GetPosNum(),vectItem[i]));
			m_ctrlConfigList.AddItem(idxItem++,static_cast<CListItemData *> (vectItem[i]));
		}
		iter++;
	}
	_RefreshSearchList();

	if(m_IsAddSamples)
	{
		OnEnChangeValueNumprefix();
		OnEnChangeValueDilution();
		OnDtnDatetimechangeDateApplydate(NULL,NULL);
		// “重复次数”初始化
		m_ctrlEditRepeations.SetWindowText(_T("1"));
	}
	
	// 理论浓度控件
	CWnd * pWnd = GetDlgItem(IDC_Title_StartConc);
	pWnd->EnableWindow(FALSE);
	pWnd = GetDlgItem(IDC_Title_Increament);
	pWnd->EnableWindow(FALSE);
	m_ctrlEditStartConc.EnableWindow(FALSE);
	m_ctrlEditIncreament.EnableWindow(FALSE);
	m_ctrlSpinBtnStartConc.EnableWindow(FALSE);
	m_ctrlSpinBtnIncreament.EnableWindow(FALSE);

	// 浓度单位控件显示
	pWnd = GetDlgItem(IDC_Value_Unit);
	pWnd->SetWindowText(_T(""));
	pWnd = GetDlgItem(IDC_Value_Unit2);
	pWnd->SetWindowText(_T(""));
	return TRUE;
}
Пример #23
0
long CCompileEditView::AddCompileInfotoList(WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/)
{
	if(m_pParentDlg == NULL)
		return 0;

	CWnd* pPromptWnd = m_pParentDlg->GetDlgItem(IDC_PROMTEDIT);
	if(pPromptWnd == NULL)
		return 0;

	CWnd* pBtError = m_pParentDlg->GetDlgItem(IDC_ERROR);

	nodErrorInfo* pError = (nodErrorInfo*)lParam;
	int nCount = GetErrorCount();
	CString strText;
	if(pError != NULL)
	{
		/*
		if(wParam == 10)
		{
		}
		else if(wParam == 11)
		{
		}
		else if(wParam == 12)
		{
		}
		else*/
		{			
			if(pBtError != NULL)
			{
				pBtError->EnableWindow(TRUE);
			}
			if(nCount == 0 && pError->m_nBegin >= 0 && pError->m_nEnd >= 0)
			{
				strText = _T("公式有几个错误!");
				pPromptWnd->SetWindowText(strText);
			}
		}		
		if(CDlgFormulaEdit::m_pErrorDlg != NULL)
		{
			CDlgFormulaEdit::m_pErrorDlg->SendMessage(HX_USER_COMPILE_INFO, wParam, lParam);
		}
	}
	else
	{
		strText = _T("公式编译(测试)通过!");
		if(pBtError != NULL)
		{
			pBtError->EnableWindow(FALSE);
		}
		pPromptWnd->SetWindowText(strText);
	}
	
	return 0;
	/*
	if(m_pParentDlg == NULL)
		return;

	CWnd* pPromptWnd = m_pParentDlg->GetDlgItem(IDC_PROMTEDIT);
	if(pPromptWnd != NULL)
	{
		CString strText;
		nodErrorInfo* pError = (nodErrorInfo*)lParam;
		int nCount = GetErrorCount();
		if(pError != NULL)
		{	
			if(wParam == 10)
			{
				strText.Format("%s",pError->GetError());
			}
			else if(wParam == 11)
			{
				strText.Format("%s - %i 错误,%i 警告",pError->GetError(),nCount,0);
			}
			else if(wParam == 12)
			{
				strText.Format("%s - %i 错误,%i 警告",pError->GetError(),nCount>0?nCount-1:nCount,0);
			}
			else
			{
				strText.Format("错误号:%i;错误信息:%s (%s)错误行列:%i-%i",pError->m_nError,
					hxRelaceReturnKey(pError->GetError(),"\r\n"),hxGetErrorInfoByErrorNum(pError->m_nError),pError->m_nBegin,pError->m_nEnd);
				
				if(nCount == 1 && pError->m_nBegin >= 0 && pError->m_nEnd >= 0)
				{
					this->GetRichEditCtrl().SetSel(pError->m_nBegin,pError->m_nEnd);
				}
			}
		}
		else
		{
			strText = "公式编译(测试)通过!";
		}

//		CString strOldText;
//		pPromptWnd->GetWindowText(strOldText);
		pPromptWnd->SetWindowText(strText);
	}
	*/


	/*
	if(m_pListCtrl == NULL)
		return;

	CString strText;
	short nImage;
	nodErrorInfo* pError = (nodErrorInfo*)lParam;
	int nCount = m_pListCtrl->GetItemCount();
	if(pError != NULL)
	{	
		if(wParam == 10)
		{
			nImage = 2;
			strText.Format("%s",pError->GetError());
		}
		else if(wParam == 11)
		{
			nImage = 2;
			strText.Format("%s - %i 错误,%i 警告",pError->GetError(),nCount,0);
		}
		else if(wParam == 12)
		{
			nImage = 2;
			strText.Format("%s - %i 错误,%i 警告",pError->GetError(),nCount>0?nCount-1:nCount,0);
		}
		else
		{
			nImage = 0;
			strText.Format("错误号:%i;错误信息:%s (%s)错误行列:%i-%i",pError->m_nError,
				hxRelaceReturnKey(pError->GetError(),"\r\n"),hxGetErrorInfoByErrorNum(pError->m_nError),pError->m_nBegin,pError->m_nEnd);

			if(nCount == 0 && pError->m_nBegin >= 0 && pError->m_nEnd >= 0)
			{
				this->GetRichEditCtrl().SetSel(pError->m_nBegin,pError->m_nEnd);
			}
		}
	}
	else
	{
		strText = "公式编译(测试)通过!";
		nImage = 1;
	}	
	m_pListCtrl->InsertItem(nCount,strText,nImage);
	*/
}
Пример #24
0
void CStandardConfigDlg::_DisplayCurrentStanderd(const StandardRecord &record)
{
	CString strTemp;
	COleDateTime tempDate;
	CWnd * pWnd;
	// 生产日期
	pWnd = GetDlgItem(IDC_Value_ProductDate);
	tempDate = record.ProductionDate;
	strTemp = tempDate.Format(_T("%Y-%m-%d"));
	pWnd->SetWindowText(strTemp);

	// 失效日期
	pWnd = GetDlgItem(IDC_Value_ExpirationDate);
	tempDate = record.ExpirationDate;
	strTemp = tempDate.Format(_T("%Y-%m-%d"));
	pWnd->SetWindowText(strTemp);

	// 额定次数
	pWnd = GetDlgItem(IDC_Value_RatedTestTimes);
	strTemp.Format(_T("%d"),record.RatedTestTimes);
	pWnd->SetWindowText(strTemp);

	// 剩余次数
	pWnd = GetDlgItem(IDC_Value_RemainTimes);
	strTemp.Format(_T("%d"),record.RemainTimes);
	pWnd->SetWindowText(strTemp);

	// 浓度单位
	pWnd = GetDlgItem(IDC_Value_Unit);
	pWnd->SetWindowText(record.Unit);

	// 标准点个数
	pWnd = GetDlgItem(IDC_Value_CountOfStdPoints);
	strTemp.Format(_T("%d"),record.CountOfStdPoints);
	pWnd->SetWindowText(strTemp);

	// 先隐藏标注点5~10
	for (int i=0; i<10; i++)
	{
		m_ctrlStdPointTitle[i].ShowWindow(SW_HIDE);
		m_ctrlStdPointValue[i].ShowWindow(SW_HIDE);;
	}

	// 标准点
	for(int i = 0; i < record.CountOfStdPoints; i++)
	{
		int indexConc = i + 1;
		strTemp.Format(_T("%g"),record.StdConc[i]);
		m_ctrlStdPointValue[i].SetWindowText(strTemp);
		m_ctrlStdPointTitle[i].ShowWindow(SW_SHOW);
		m_ctrlStdPointValue[i].ShowWindow(SW_SHOW);
	}

	// 从“标准点个数”与“选择的配置节点个数”中选择较小的个数,刷新列表
	if(record.CountOfStdPoints < m_nCountOfConfigNode)
		m_nNumOfValidConfigNode = record.CountOfStdPoints;
	else 
		m_nNumOfValidConfigNode = m_nCountOfConfigNode;

	// 浓度点索引选项表
	vector<CString> arrOptionsConcIndex;
	for(int i=0; i < record.CountOfStdPoints; i++)
	{
		// 数组索引    浓度点索引      字符
		// 0        ->      1      ->    A
		// 1        ->      2      ->    B
		// ... ...
		CString strTemp;
		strTemp.Format(_T("%c"),(i+1) + 64);		// 数组索引从0起始,而浓度点索引从1开始,所以应该是i+1
		arrOptionsConcIndex.push_back(strTemp);
	}

	// 配置列表数据更新
	for(int i = 0; i < m_nNumOfValidConfigNode; i++)
	{
		// 数组索引    浓度点索引 
		// 0        ->      1     
		// 1        ->      2     
		// ... ...

		CString strTemp;
		// 检测项目
		m_ComboxProjectName.GetWindowText(strTemp);
		m_vctListItemData[i]->SetProject(strTemp);

		// 记录ID和批号
		m_ComboxBatchNum.GetWindowText(strTemp);
		m_vctListItemData[i]->SetBatchNum(strTemp);

		// 浓度点索引赋值
		if(m_IsAddStanderds == true)
			m_vctListItemData[i]->SetConcIndex(i);
		// 浓度点索引选项
		m_vctListItemData[i]->SetOptionsConcIndex(arrOptionsConcIndex);
	}
	m_ctrlConfigList.RedrawAllItems();
}
Пример #25
0
/*******************************************************************************
  Function Name  : vEnableDisableButtons
  Input(s)       : -
  Output         : -
  Functionality  : This function will enable or disable UI buttons as per the
                   selection
  Member of      : CHardwareListing
  Author(s)      : Raja N
  Date Created   : 21.2.2005
  Modifications  : Pradeep Kadoor, 14.12.2010, Disabling of hardware details removed
*******************************************************************************/
void CHardwareListing::vEnableDisableButtons()
{
	BOOL bSelectEnable = FALSE;
	BOOL bRemoveEnable = FALSE;

	// Enable Disable Select Button
	// Get the selected hardware count
	int nSelectedHardware = m_omSelectedHwList.GetItemCount();
	// Check for the minimum of supported channels or available channels
	if( (UINT)nSelectedHardware < MIN( (UINT)m_nSize, CHANNEL_ALLOWED ) ){
		if( m_omHardwareList.GetSelectedCount() != 0 ){
			bSelectEnable = TRUE;
		}
	}

	// Check the item count in the selected list and enable/disable
	if( nSelectedHardware != 0 &&
		m_omSelectedHwList.GetSelectedCount() != 0 ){
		bRemoveEnable = TRUE;
	}

	// Update Window.
	CWnd* pWnd = NULL;
	// Select Button
	pWnd = GetDlgItem( IDC_BUT_SELECT );
	if( pWnd != NULL )
	{
		pWnd->EnableWindow( bSelectEnable );
	}
	// Remove Button
	pWnd = GetDlgItem( IDC_BUT_REMOVE );
	if( pWnd != NULL )
	{
		pWnd->EnableWindow( bRemoveEnable );
	}
	// Enable Hardware Details
	BOOL bHardwareDetailsEnable = TRUE;


	// Driver ID
	pWnd = GetDlgItem( IDC_EDIT_DRIVER_ID );
	if( pWnd != NULL )
	{
		pWnd->EnableWindow( bHardwareDetailsEnable );
		// If disabled then clear the text
		if( bHardwareDetailsEnable == FALSE )
		{
			pWnd->SetWindowText("");
		}
	}
	// Network Name
	pWnd = GetDlgItem( IDC_EDIT_NET_NAME );
	if( pWnd != NULL )
	{
		pWnd->EnableWindow( bHardwareDetailsEnable );
		// If disabled then clear the text
		if( bHardwareDetailsEnable == FALSE )
		{
			pWnd->SetWindowText("");
		}
	}
	// Firmware
	pWnd = GetDlgItem( IDC_EDIT_FIRMWARE );
	if( pWnd != NULL )
	{
		pWnd->EnableWindow( bHardwareDetailsEnable );
		// If disabled then clear the text
		if( bHardwareDetailsEnable == FALSE )
		{
			pWnd->SetWindowText("");
		}
	}
	// Blink Button
	pWnd = GetDlgItem( IDC_BUT_BLINK );
	if( pWnd != NULL )
	{
		if(bSelectEnable == FALSE || m_pfnBlinkFunction == NULL)
		{
			pWnd->EnableWindow( FALSE );//venkat
		}
		else
		{
			pWnd->EnableWindow( TRUE );
		}
	}
}
Пример #26
0
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
UINT ThreadFun(LPVOID pParam){  //线程要调用的函数
   WSADATA wsd;
   int len=sizeof(struct sockaddr_in);
   int ret;
	TCHAR recvbuf[BUFSIZE];
   if(WSAStartup(MAKEWORD(2,2),&wsd)!=0)
   {
	   printf("WSAStartup()failed\n");
	   return -1;
   }
   if((sock=WSASocket(AF_INET,SOCK_DGRAM,0,NULL,0,
	   WSA_FLAG_MULTIPOINT_C_LEAF|WSA_FLAG_MULTIPOINT_D_LEAF|
	   WSA_FLAG_OVERLAPPED))==INVALID_SOCKET)
   {
	   printf("socket failed with :%d\n",WSAGetLastError());
	   WSACleanup();
	   return -1;
   }
   //将sock绑定到本机端口上
   local.sin_family=AF_INET;
   local.sin_port=htons(MCASTPORT);
   local.sin_addr.s_addr=INADDR_ANY;

   if(bind(sock,(struct sockaddr*)&local,sizeof(local))==SOCKET_ERROR)
   {
	   printf("bind failed with %d\n",WSAGetLastError());
	   closesocket(sock);
	   WSACleanup();
	   return -1;
   
   
   }
   //加入多播组

   remote.sin_family=AF_INET;
   remote.sin_port=htons(MCASTPORT);
   remote.sin_addr.s_addr=inet_addr(MCASTADDR);

   if((sockM=WSAJoinLeaf(sock,(SOCKADDR*)&remote,sizeof(remote),
	   NULL,NULL,NULL,NULL,
	   JL_BOTH))==INVALID_SOCKET)
   {
     printf("WSAJoinLeaf()failed:%d\n",WSAGetLastError());
     closesocket(sock);
	 WSACleanup();
	 return -1;
   }
   //接收多播数据,当收到的数据为QUIT时退出

   while(1)
   {
	   if((ret=recvfrom(sock,recvbuf,BUFSIZE,0,
		   (struct sockaddr*)&from,&len))==SOCKET_ERROR)
	   {
		   //printf("recvfrom failed with :%d\n",WSAGetLastError());
		   closesocket(sockM);
		   closesocket(sock);
		   WSACleanup();
		   return -1;
	   }
	   if(strcmp(recvbuf,"QUIT")==0)  break;
	   else{
		   recvbuf[ret]='\0';
		   Str+=inet_ntoa(from.sin_addr);
		   Str+=":";
		   Str+=recvbuf;
		   Str+="\r\n";
		   HWND hWnd = GetDlgItem(AfxGetMainWnd()->m_hWnd,IDC_EDIT1);
		   CWnd *pWnd = CWnd::FromHandle(hWnd);
		   pWnd->SetWindowText(_T(Str));

	   }
   }

   closesocket(sockM);
   closesocket(sock);
   WSACleanup();
   return 0;
}
Пример #27
0
//查找线程处理函数
DWORD WINAPI CDlgFormulaFind::FindComp(LPVOID pParameter)
{
	CDlgFormulaFind* pCompFind = (CDlgFormulaFind*)(pParameter);
	if( pCompFind == NULL)
		return 0;

	CWnd* pWnd = pCompFind->GetDlgItem(IDC_STARTBUTTON);
	if(pWnd != NULL)
	{
		pWnd->EnableWindow(false);
	}
	pWnd = pCompFind->GetDlgItem(IDC_STOPBUT);
	if(pWnd != NULL)
	{
		pWnd->EnableWindow(true);
	}

	pCompFind->m_wndAnimate.Play(0,-1,-1);
	CString strKey ;
	pCompFind->m_wndKeyCombo.GetWindowText(strKey);
	strKey.MakeUpper();
//	DWORD dwFindMask = pCompFind->GetFindMask();
	DWORD dwFindMask = pCompFind->m_nFindMask;
	if( dwFindMask == 0 ) 
		return 0;
	
	CListCtrl* pListCtrl = &(pCompFind->m_wndResultList);
	if( pListCtrl == NULL)
		return 0;

	pListCtrl->DeleteAllItems();
	CMapVariabile* pVarsMap = CDlgFormulaMan::m_pExternExpression;
	if(pVarsMap != NULL)
	{
		POSITION pos = pVarsMap->GetStartPosition();
		pWnd = pCompFind->GetDlgItem(IDC_RESULTSTATIC);

		CString sName;
		CValue *pVal;
		while (pos != NULL && pCompFind->m_bThreadRun)
		{			
			pVarsMap->GetNextAssoc (pos, sName, pVal);

			if(pVal != NULL)
			{
				if( pVal->IsStyle(HX_EXPRESSSENTENCE) )
				{
					CString strFindText = _T("正在查找 --");
					strFindText +=  ((CExpValue*)pVal)->GetWholeName();
					pWnd->SetWindowText( strFindText);
					CString strRet;
					if( ((CExpValue*)pVal)->Find(strKey,strRet,dwFindMask) )
					{

						int nCount = pListCtrl->GetItemCount();
						CString strText;
						strText.Format(TEXT("%d"), nCount+1);

						// Insert the item, select every other item.
						CExpression* pExpression = ((CExpValue*)pVal)->GetExp();
						if(pExpression )
						{
							DWORD dwMask = (DWORD)pExpression->GetExpressType();
							dwMask &= 0xf;
							if ((pCompFind->m_dwMask & dwMask) == 0)
							{
								continue;
							}

							pListCtrl->InsertItem(
								LVIF_TEXT|LVIF_STATE, nCount, strText, 
								(nCount%2)==0 ? LVIS_SELECTED : 0, LVIS_SELECTED,
								0, 0);
							pListCtrl->SetItemData(nCount,(DWORD)pExpression);

							int nNameIndex = strRet.Find(_T("公式全名"));
							int nDescrible = strRet.Find(_T("公式描述"));
							if( nDescrible - nNameIndex != 8)
							{
								CString strDescrible = strRet.Mid(
									nNameIndex+8,nDescrible-nNameIndex-8);
								pListCtrl->SetItemText(nCount, 2,  strDescrible);
							}

							CString strWholeName = strRet.Left(nNameIndex);
							pListCtrl->SetItemText(nCount, 1, strWholeName.Mid(1,nNameIndex));

							CString strGroup;
							switch( dwMask )
							{
							case Tech :
								{
									strGroup = CTreeCtrlFormula::g_strTech;
									break;
								}
							case Exchange :
								{

									strGroup = CTreeCtrlFormula::g_strExchange;
									break;
								}
							case Condition :
								{
									strGroup = CTreeCtrlFormula::g_strCondition;
									break;
								}
							case MoreKLine :
								{
									strGroup = CTreeCtrlFormula::g_strColorKLine;
									break;
								}
							case Strategy : //20090302 YJT 增加 Strategy
								{
									strGroup = CTreeCtrlFormula::g_strStrategy;
									break;
								}
							default :
								{
									return 0;
								}
							}

							pListCtrl->SetItemText(nCount, 3, strGroup);
						}
					}
				}		
			}
		}

		CString strFindText ;
		strFindText.Format(_T("找到 %d 个对象"),pListCtrl->GetItemCount());
		pWnd->SetWindowText( strFindText);
		pWnd = pCompFind->GetDlgItem(IDC_STARTBUTTON);

		if(pWnd != NULL)
		{
			pWnd->EnableWindow(true);
		}
		pWnd = pCompFind->GetDlgItem(IDC_STOPBUT);
		if(pWnd != NULL)
		{
			pWnd->EnableWindow(false);
		}
		pCompFind->m_wndAnimate.Stop();

	}
	return 0;
}
Пример #28
0
BOOL CPasswordPolicyDlg::OnInitDialog()
{
  CPWDialog::OnInitDialog();

  // If started with Tall and won't fit - return to be called again with Wide
  if (m_bLongPPs && !GetMainDlg()->LongPPs(this)) {
    EndDialog(-1);
    return FALSE;
  }
  
  if (m_bReadOnly && m_uicaller != IDS_GENERATEPASSWORD) {
    // Change OK button test
    CString cs_close(MAKEINTRESOURCE(IDS_CLOSE));
    GetDlgItem(IDOK)->SetWindowText(cs_close);

    // Hide the Cancel button
    GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
    GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
  }

  CString cs_title;
  switch (m_uicaller) {
  case IDS_OPTIONS:
    // Set correct window title
    cs_title.LoadString(IDS_EDIT_DEFAULT_POLICY);
    SetWindowText(cs_title);

    // These are only used in Manage -> Generate Password or Add/Edit Policy names
    GetDlgItem(IDC_GENERATEPASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_GENERATEPASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_COPYPASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_COPYPASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_PASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_PASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_POLICYNAME)->EnableWindow(FALSE);
    GetDlgItem(IDC_POLICYNAME)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_POLICYLIST)->EnableWindow(FALSE);
    GetDlgItem(IDC_POLICYLIST)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_USENAMED_POLICY)->EnableWindow(FALSE);
    GetDlgItem(IDC_USENAMED_POLICY)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_STATIC_NAMEDPOLICY)->ShowWindow(SW_HIDE);
    break;
  case IDS_GENERATEPASSWORD:
    {
      // Set correct window title
      cs_title.LoadString(IDS_GENERATEPASSWORD);
      SetWindowText(cs_title);

      // These are only used in Manage -> Add/Edit Policy names
      GetDlgItem(IDC_POLICYNAME)->EnableWindow(FALSE);
      GetDlgItem(IDC_POLICYNAME)->ShowWindow(SW_HIDE);

      // Used to generate passwords
      GetDlgItem(IDC_POLICYLIST)->ShowWindow(SW_SHOW);
      GetDlgItem(IDC_USENAMED_POLICY)->EnableWindow(TRUE);
      GetDlgItem(IDC_USENAMED_POLICY)->ShowWindow(SW_SHOW);
      GetDlgItem(IDC_STATIC_NAMEDPOLICY)->ShowWindow(SW_HIDE);

      // Populate the combo box
      m_cbxPolicyNames.ResetContent();

      // Get all password policy names
      std::vector<std::wstring> vNames;
      GetMainDlg()->GetPolicyNames(vNames);

      // Add Default
      const CString cs_default(MAKEINTRESOURCE(IDSC_DEFAULT_POLICY));
      m_cbxPolicyNames.AddString(cs_default);

      for (std::vector<std::wstring>::iterator iter = vNames.begin();
           iter != vNames.end(); ++iter) {
        m_cbxPolicyNames.AddString(iter->c_str());
      }

      // Select Default
      m_cbxPolicyNames.SelectString(-1, cs_default);

      // and check the box
      ((CButton *)GetDlgItem(IDC_USENAMED_POLICY))->SetCheck(BST_CHECKED);

      // Centre the OK button & change its text
      RECT rc, rcOK;
      CWnd *pOK = GetDlgItem(IDOK);

      GetClientRect(&rc);
      pOK->GetWindowRect(&rcOK);
      ScreenToClient(&rcOK);
      int top = rcOK.top;
      pOK->GetClientRect(&rcOK);
      int left = (rc.right - rcOK.right) / 2;
      pOK->MoveWindow(left, top, rcOK.right, rcOK.bottom);

      CString cs_close(MAKEINTRESOURCE(IDS_CLOSE));
      pOK->SetWindowText(cs_close);

      // Hide the Cancel & Help buttons
      GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
      GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
      GetDlgItem(ID_HELP)->EnableWindow(FALSE);
      GetDlgItem(ID_HELP)->ShowWindow(SW_HIDE);

      Fonts::GetInstance()->ApplyPasswordFont(GetDlgItem(IDC_PASSWORD));
      m_ex_password.SetSecure(false);

      // Remove password character so that the password is displayed
      m_ex_password.SetPasswordChar(0);

      // Load bitmap
      UINT nImageID = PWSprefs::GetInstance()->GetPref(PWSprefs::UseNewToolbar) ?
        IDB_COPYPASSWORD_NEW : IDB_COPYPASSWORD_CLASSIC;
      BOOL brc = m_CopyPswdBitmap.Attach(::LoadImage(
                                                     ::AfxFindResourceHandle(MAKEINTRESOURCE(nImageID), RT_BITMAP),
                                                     MAKEINTRESOURCE(nImageID), IMAGE_BITMAP, 0, 0,
                                                     (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_SHARED)));
      ASSERT(brc);

      FixBitmapBackground(m_CopyPswdBitmap);
      CButton *pBtn = (CButton *)GetDlgItem(IDC_COPYPASSWORD);
      pBtn->SetBitmap(m_CopyPswdBitmap);

      break;
    }
  case IDS_PSWDPOLICY:
    // Set correct window title
    cs_title.LoadString(m_policyname.IsEmpty() ? IDS_ADD_NAMED_POLICY : IDS_EDIT_NAMED_POLICY);
    SetWindowText(cs_title);

    // These are only used in Manage -> Password Policy
    GetDlgItem(IDC_GENERATEPASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_GENERATEPASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_COPYPASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_COPYPASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_PASSWORD)->EnableWindow(FALSE);
    GetDlgItem(IDC_PASSWORD)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_POLICYLIST)->EnableWindow(FALSE);
    GetDlgItem(IDC_POLICYLIST)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_USENAMED_POLICY)->EnableWindow(FALSE);
    GetDlgItem(IDC_USENAMED_POLICY)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_STATIC_NAMEDPOLICY)->ShowWindow(SW_SHOW);

    if (!m_policyname.IsEmpty() && m_iter->second.usecount > 0) {
      // Cannot edit the policy 'Name' if it is present and use count > 0
      m_PolicyNameEdit.SetReadOnly(TRUE);
      m_PolicyNameEdit.EnableWindow(FALSE);
    }

    m_PolicyNameEdit.SetWindowText(m_policyname);
    // Max. length of policy name is 255 - only one byte used for length
    // in database header
    m_PolicyNameEdit.SetLimitText(255);
    break;
  }

  setupBuddy(this, IDC_PWLENSPIN, IDC_DEFPWLENGTH, m_PWDefaultLength, 4);
  setupBuddy(this, IDC_SPINDIGITS, IDC_MINDIGITLENGTH, m_PWDigitMinLength);
  setupBuddy(this, IDC_SPINLOWERCASE, IDC_MINLOWERLENGTH, m_PWLowerMinLength);
  setupBuddy(this, IDC_SPINUPPERCASE, IDC_MINUPPERLENGTH, m_PWUpperMinLength);
  setupBuddy(this, IDC_SPINSYMBOLS, IDC_MINSYMBOLLENGTH, m_PWSymbolMinLength);

  m_save[SAVE_LOWERCASE] = m_PWUseLowercase;
  m_save[SAVE_UPPERCASE] = m_PWUseUppercase;
  m_save[SAVE_DIGITS] = m_PWUseDigits;
  m_save[SAVE_SYMBOLS] = m_PWUseSymbols;
  m_save[SAVE_EASYVISION] = m_PWEasyVision;
  m_save[SAVE_PRONOUNCEABLE] = m_PWMakePronounceable;

  m_savelen[SAVE_LOWERCASE] = m_PWLowerMinLength;
  m_savelen[SAVE_UPPERCASE] = m_PWUpperMinLength;
  m_savelen[SAVE_DIGITS] = m_PWDigitMinLength;
  m_savelen[SAVE_SYMBOLS] = m_PWSymbolMinLength;

  // Set up the correct controls (enabled/disabled)
  do_hex(m_PWUseHexdigits == TRUE);

  int iSet = EVPR_NONE;
  if (m_PWEasyVision == TRUE)
    iSet = EVPR_EV;
  else
    if (m_PWMakePronounceable == TRUE)
      iSet = EVPR_PR;
  do_easyorpronounceable(iSet);

  GetDlgItem(IDC_OWNSYMBOLS)->EnableWindow(m_PWUseSymbols);
  GetDlgItem(IDC_RESET_SYMBOLS)->EnableWindow(m_PWUseSymbols);

  m_SymbolsEdit.SetWindowText(m_Symbols);

  if (m_uicaller == IDS_GENERATEPASSWORD) {
    // Disable Specific policy controls as default is to use a named policy (database default)
    SetSpecificPolicyControls(FALSE);

    m_pToolTipCtrl = new CToolTipCtrl;
    if (!m_pToolTipCtrl->Create(this, TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOPREFIX)) {
      pws_os::Trace(L"Unable To create Advanced Dialog ToolTip\n");
      delete m_pToolTipCtrl;
      m_pToolTipCtrl = NULL;
      return TRUE;
    }

    // Tooltips
    EnableToolTips();

    // Activate the tooltip control.
    m_pToolTipCtrl->Activate(TRUE);
    m_pToolTipCtrl->SetMaxTipWidth(300);
    // Quadruple the time to allow reading by user
    int iTime = m_pToolTipCtrl->GetDelayTime(TTDT_AUTOPOP);
    m_pToolTipCtrl->SetDelayTime(TTDT_AUTOPOP, 4 * iTime);

    AddTool(IDC_COPYPASSWORD, IDS_CLICKTOCOPY);
  }

  // Set appropriate focus
  GetDlgItem(m_uicaller == IDS_GENERATEPASSWORD ? IDC_GENERATEPASSWORD : IDCANCEL)->SetFocus();
  return FALSE;
}
Пример #29
0
void SetWindowNumber(CWnd& wnd, int nNumber)
{
    CString s;
    s.Format(_T("%d"), nNumber);
    wnd.SetWindowText(s);
}
Пример #30
0
void CIwResultPropertyPage::InitManagerResult(int nManagerIndex, bool bChecked, const CString & sSupplierName, const TImportResult& tImportResult)
{
	ASSERT(nManagerIndex >= 0 && nManagerIndex <= sizeof(g_arrIwManagerControls)/sizeof(TIwManagerControls) - 1);
	const TIwManagerControls& tIwManagerControls = g_arrIwManagerControls[nManagerIndex];

	CWnd* pwndMgr = GetDlgItem(tIwManagerControls.nResPageMgrId);
	CWnd* pwndSuccessful = GetDlgItem(tIwManagerControls.nResPageSucessfulId);
	CWnd* pwndFailed = GetDlgItem(tIwManagerControls.nResPageFailedId);
	CWnd* pwndUnprocessed = GetDlgItem(tIwManagerControls.nResPageUnprocessedId);
	CWnd* pwndTotal = GetDlgItem(tIwManagerControls.nResPageTotalId);

	ASSERT(pwndMgr != 0);
	ASSERT(pwndSuccessful != 0);
	ASSERT(pwndFailed != 0);
	ASSERT(pwndUnprocessed != 0);
	ASSERT(pwndTotal != 0);

	pwndMgr->SetWindowText(sSupplierName);

	if (!bChecked) {
		pwndMgr->EnableWindow(0);
		pwndSuccessful->EnableWindow(0);
		pwndFailed->EnableWindow(0);
		pwndUnprocessed->EnableWindow(0);
		pwndTotal->EnableWindow(0);
	} else {

		CString sStatistics;
		CString sTmp;

		pwndSuccessful->GetWindowText(sStatistics);
		sStatistics += _T(" ");
		if (tImportResult.nSuccess == -1) {
			sStatistics += LS (L_UNDEFINED_IMPORT_RESULT);
		} else {
			sTmp.Format(_T("%d"), tImportResult.nSuccess);
			sStatistics += sTmp;
		}
		pwndSuccessful->SetWindowText(sStatistics);

		pwndFailed->GetWindowText(sStatistics);
		sStatistics += _T(" ");
		if (tImportResult.nFailure == -1) {
			sStatistics += LS (L_UNDEFINED_IMPORT_RESULT);
		} else {
			sTmp.Format(_T("%d"), tImportResult.nFailure);
			sStatistics += sTmp;
		}
		pwndFailed->SetWindowText(sStatistics);

		pwndUnprocessed->GetWindowText(sStatistics);
		sStatistics += _T(" ");
		if (tImportResult.nUnprocessed == -1) {
			sStatistics += LS (L_UNDEFINED_IMPORT_RESULT);
		} else {
			sTmp.Format(_T("%d"), tImportResult.nUnprocessed);
			sStatistics += sTmp;
		}
		pwndUnprocessed->SetWindowText(sStatistics);

		pwndTotal->GetWindowText(sStatistics);
		sStatistics += _T(" ");
		if (tImportResult.nTotal == -1) {
			sStatistics += LS (L_UNDEFINED_IMPORT_RESULT);
		} else {
			sTmp.Format(_T("%d"), tImportResult.nTotal);
			sStatistics += sTmp;
		}
		pwndTotal->SetWindowText(sStatistics);
	}
}