void TwitterAuthSelectDialog::ShowCurrentStatus( bool rescan /* = FALSE */ ) { CButton *bp = (CButton *)GetDlgItem( IDC_BUTTON_GET_TOKEN ); bp->EnableWindow( m_useOAuth ); bp = (CButton *)GetDlgItem( IDC_RADIO_OAUTH ); bp->SetCheck( m_useOAuth ? 1 : 0 ); bp = (CButton *)GetDlgItem( IDC_RADIO_BASIC ); bp->SetCheck( m_useBASIC ? 1 : 0 ); CString status; CStatic *sp = (CStatic *)GetDlgItem( IDC_TOKEN_STATUS ); if ( (m_oauthToken.GetLength() > 0) && (m_oauthTokenSecret.GetLength() > 0) ) status.LoadString( IDS_ACCESSTOKEN_ACQUIRED ); else status.LoadString( IDS_ACCESSTOKEN_UNTAKEN ); sp->SetWindowText( status ); CEdit *p = (CEdit *)GetDlgItem(IDC_EDIT_USERNAME); if ( rescan ) p->GetWindowText( m_username ); p->SetWindowText( m_username ); p->EnableWindow( m_useBASIC ); p = (CEdit *)GetDlgItem(IDC_EDIT_PASSWORD); if ( rescan ) p->GetWindowText( m_password ); p->SetWindowText( m_password ); p->EnableWindow( m_useBASIC ); }
void CID3v2Page1::OnNormalize() { BOOL bReplaceUnderscores = theApp.m_NormeProfile.GetUnderscoresReplacement(); CEdit* pEditTitle = (CEdit*) GetDlgItem( IDC_EDIT_TITLE ); CEdit* pEditComment = (CEdit*) GetDlgItem( IDC_EDIT_COMMENT ); CString strArtist = m_comboArtist.GetText(); CString strAlbum = m_comboAlbum.GetText(); CString strTitle; CString strComment; pEditTitle->GetWindowText( strTitle ); pEditComment->GetWindowText( strComment ); strArtist = CAudioFile::Normalize( strArtist, theApp.m_NormeProfile.GetNorm( ARTIST ), bReplaceUnderscores ); strAlbum = CAudioFile::Normalize( strAlbum, theApp.m_NormeProfile.GetNorm( ALBUM ), bReplaceUnderscores ); strTitle = CAudioFile::Normalize( strTitle, theApp.m_NormeProfile.GetNorm( TITLE ), bReplaceUnderscores ); strComment = CAudioFile::Normalize( strComment, theApp.m_NormeProfile.GetNorm( COMMENT ), bReplaceUnderscores ); m_comboArtist.SetText( strArtist ); m_comboAlbum.SetText( strAlbum ); pEditTitle->SetWindowText( strTitle ); pEditComment->SetWindowText( strComment ); }
//=========================================================================== void CFAVReaderDlg::OnEnChangeReaderWriteData() //=========================================================================== { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here CEdit* pEditW = (CEdit*)GetDlgItem(IDC_READER_WRITE_DATA); CEdit* pEditL = (CEdit*)GetDlgItem(IDC_READER_LENGTH_DATA); CString strW = _T(""); CString strL = _T(""); pEditW->GetWindowText(strW); pEditL->GetWindowText(strL); int nWriteLength = strW.GetLength(); int nWordsLength = CStringHexToInt(strL); int nDiff; nDiff = nWordsLength*4 - nWriteLength; if(nDiff > 0) strW.Format(_T("Need to enter the %d text."), nDiff); else strW.Format(_T("More than %d text."), -nDiff); m_ToolTips.AddTool(GetDlgItem(IDC_READER_WRITE_DATA), strW); }
void EditAmazonAccessKey::OnOK() { CEdit *p = (CEdit *)GetDlgItem( IDC_EDIT_ACCESS_KEY_ID ); p->GetWindowText( m_accessKeyID ); p = (CEdit *)GetDlgItem( IDC_EDIT_ACCESS_KEY_SECRET ); p->GetWindowText( m_accessKeySecret ); if ( m_accessKeyID.GetLength() > 0 && m_accessKeySecret.GetLength() > 0 ) CDialog::OnOK(); }
void CNewsHubDlg::OnBnClickedServerStart() { CEdit* pPort = (CEdit*)GetDlgItem(IDC_SERVER_PORT); CString strPort; pPort->GetWindowText(strPort); int port = atoi(CT2CA(strPort)); CButton* pServerTcp = (CButton*)GetDlgItem(IDC_SERVER_TCP); bool bTcp = (pServerTcp->GetCheck() == BST_CHECKED); ServerLoop* serverLoop; try { NewsHub::Server* server; if (bTcp) server = new NewsHub::TcpServer(port); else server = new NewsHub::UdpServer(port); serverLoop = new ServerLoop(server, new NewsHub::ServerThreadLoop(*server, *this, bTcp)); } catch (std::exception & e) { MessageBox(CString(e.what()), _T("Exception"), MB_OK); return; } CString serverDescription = CString(bTcp?"TCP":"UDP") + CString(" server is listening on port ") + strPort; CListBox* pRunningServers = (CListBox*)GetDlgItem(IDC_RUNNING_SERVERS); int row = pRunningServers->AddString(serverDescription); pRunningServers->SetItemDataPtr(row, serverLoop); }
void CDeviceAddWriteKeyDlg::OnWriteKeyChange(UINT /*wNotifyCode*/, int /*wID*/, HWND hWndCtl) { CEdit wndWriteKey = hWndCtl; wndWriteKey.GetWindowText( m_strWriteKey.GetBuffer(NDAS_DEVICE_WRITE_KEY_LEN + 1), NDAS_DEVICE_WRITE_KEY_LEN + 1); m_strWriteKey.ReleaseBuffer(); CButton wndOK = GetDlgItem(IDOK); if (m_strWriteKey.GetLength() == 5) { BOOL fValid = ::NdasValidateStringIdKey( m_strDeviceId, m_strWriteKey); wndOK.EnableWindow(fValid); } else { wndOK.EnableWindow(FALSE); } SetMsgHandled(FALSE); }
//----------------------------------------------------------------------------- // Purpose: // Input : pNMHDR - // pResult - //----------------------------------------------------------------------------- void CFaceEditMaterialPage::OnDeltaPosFloatSpin( NMHDR *pNMHDR, LRESULT *pResult ) { NM_UPDOWN *pNMUpDown = ( NM_UPDOWN* )pNMHDR; CEdit *pEdit = NULL; switch( pNMUpDown->hdr.idFrom ) { case IDC_SPINSCALEY: { pEdit = &m_scaleY; break; } case IDC_SPINSCALEX: { pEdit = &m_scaleX; break; } } if( pEdit != NULL ) { CString str; pEdit->GetWindowText(str); float fTmp = atof(str); fTmp += 0.1f * float( pNMUpDown->iDelta ); str.Format( "%.2f", fTmp ); pEdit->SetWindowText( str ); *pResult = 0; } }
/* ============== OnBtnExecute User wants to issue commands ============== */ void CServerCtrlDlg::OnBtnExecute( void ) { if ( !m_hSend || !m_hMappedFile ) return; // Get commands CEdit *pEdit = (CEdit *)GetDlgItem( IDC_EDIT_COMMANDS ); if ( pEdit ) { CString cmds; pEdit->GetWindowText( cmds ); // Get buffer char *sz = (char *)GetMappedBuffer( m_hMappedFile ); if ( sz ) { // Write command int32 token *(int *)&sz[ 0 ] = ENGINE_ISSUE_COMMANDS; // Write rest of line, including a return character ( necessary? ) sprintf( sz + sizeof( int ), "%s\n", (char *)(LPCSTR)cmds ); // Release the buffer ReleaseMappedBuffer( sz ); // Store off what we are expecting in return buffer m_nPendingRequest = ENGINE_ISSUE_COMMANDS; // Signal HLDS to check for requests SetEvent( m_hSend ); } } }
void InputPinDialog::OnOK() { long num = 0; CString str = ""; CEdit *p = (CEdit *)GetDlgItem( IDC_EDIT_PIN ); p->GetWindowText( str ); if ( str.GetLength() > 0 ) num = atol( str ); if ( str.GetLength() < 6 ) { // 注: 0 で始まる6桁の数字もあり得る(ことがわかった) CString ttl = _T(""); CString msg = _T(""); ttl.LoadString(IDS_TTL_INPUT_PIN); msg.LoadString(IDS_TXT_INPUT_PIN); MessageBox( msg, ttl, MB_OK|MB_ICONWARNING ); return; } char buf[64]; m_pin = _T("00000"); m_pin += ltoa( num, buf, 10 ); m_pin = m_pin.Right(6); CDialog::OnOK(); }
int CExtIdDetail::validate_date( CEdit &EditDate, LPTSTR(VarName) ) { CString DateString; EditDate.GetWindowText(DateString); // does some nifty date time validation things..... COleDateTime CheckTime; enum COleDateTime::DateTimeStatus InputDateStatus; int status = ABP_SUCCESS; CString ErrorMsg; if( !DateString.IsEmpty() ) { CheckTime.SetTime( 0, 0, 0); // parse the date string..... CheckTime.ParseDateTime( DateString, VAR_DATEVALUEONLY, LANG_USER_DEFAULT ); // check for a valid date... InputDateStatus = CheckTime.GetStatus(); if( InputDateStatus == COleDateTime::invalid ) // invalid date { CGuiMsg::GuiMessage(GUIMSG_DATE_INVALID); DateString.Empty(); EditDate.SetWindowText(DateString); UpdateData(FALSE); status = ABP_FAILURE; } } return status; }
void CExtIdDetail::check_date_input( CEdit &EditDate ) { CString DateString; EditDate.GetWindowText(DateString); int iIsSlash; int iIsNum; int status = ABP_FAILURE; int size = 0; TCHAR CurrentChar; if( !DateString.IsEmpty() ) { CurrentChar = DateString.GetAt((size = DateString.GetLength() - 1)); if( (iIsNum = isdigit( (int)CurrentChar)) || !(iIsSlash = strncmp( (LPCTSTR)&CurrentChar, (LPCTSTR)"/", 1)) ) { if( ((iIsNum >= 0) && (iIsNum <= 9)) || (!iIsSlash ) ) status = ABP_SUCCESS; } if( status == ABP_FAILURE ) { Beep( 400, 75 ); DateString.GetBufferSetLength( size ); } } return; }
//Thread safe way to update the load log void CLoadLTADlg::UpdateLoadLog() { CString sTextToAdd; g_LoadLogPipeCS.Lock(INFINITE); sTextToAdd = sm_sLoadLogPipe; sm_sLoadLogPipe = ""; g_LoadLogPipeCS.Unlock(); if(!sTextToAdd.IsEmpty()) { CString sLogText; CEdit* pEdit = ((CEdit*)GetDlgItem(IDC_LOADLOG)); pEdit->GetWindowText(sLogText); sLogText += sTextToAdd; pEdit->SetWindowText(sLogText); pEdit->LineScroll(pEdit->GetLineCount()); } }
void NetCfg::OnEnChangeEditTick() { // TODO: 如果该控件是 RICHEDIT 控件,它将不 // 发送此通知,除非重写 CDialog::OnInitDialog() // 函数并调用 CRichEditCtrl().SetEventMask(), // 同时将 ENM_CHANGE 标志“或”运算到掩码中。 // TODO: 在此添加控件通知处理程序代码 CString strout; CEdit *hEdit; int len; char *pbuf; int tick; hEdit = (CEdit*)GetDlgItem(IDC_EDIT_TICK); hEdit->GetWindowText(strout); len = strout.GetLength(); pbuf = strout.GetBuffer(); // 限定最大设置值为 60000 ms tick = atoi(pbuf); if (tick < 10) { hEdit->SetWindowText("10"); hEdit->SetSel(2,2,1); } else if (tick > 60000) { hEdit->SetWindowText("60000"); hEdit->SetSel(5,5,1); } }
void CNewsHubDlg::OnBnClickedSend() { CListBox* pRunningClients = (CListBox*)GetDlgItem(IDC_RUNNING_CLIENTS); int row = pRunningClients->GetCurSel(); if (row == LB_ERR) { MessageBox(_T("Please select one of running clients to send message through"), _T("No client selected"), MB_OK); return; } CEdit* pMessage = (CEdit*)GetDlgItem(IDC_MESSAGE); CString message; pMessage->GetWindowText(message); ClientLoop* clientLoop = (ClientLoop*)pRunningClients->GetItemDataPtr(row); unsigned int messageId = clientLoop->nextMessageId(); clientLoop->Queue()->AddMessage(messageId, std::string(CT2CA(message))); CListBox* pSentMessages = (CListBox*)GetDlgItem(IDC_SENT_MESSAGES); NewsHub::TcpClient* tcpClient = (NewsHub::TcpClient*)clientLoop->Client(); CString str; str.Format(_T("(To: %s:%d msgId:%d): %s"), CString(tcpClient->Host().c_str()), tcpClient->Port(), messageId, message); row = pSentMessages->AddString(str); MessageInfo* messageInfo = new MessageInfo; messageInfo->queue = clientLoop->Queue(); messageInfo->messageId = messageId; pSentMessages->SetItemDataPtr(row, messageInfo); pSentMessages->SetCurSel(row); }
void CFileBrowserListCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) { LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR; CEdit *pEdit = GetEditControl(); if (m_LabelEdit && pEdit != NULL) { // if label edit wasn't canceled CString NewName; pEdit->GetWindowText(NewName); // label is new item name int ItemIdx = pDispInfo->item.iItem; CDirItem& item = m_DirList.GetItem(ItemIdx); if (NewName != item.GetName()) { // if name is different CPathStr NewPath(GetFolder()); NewPath.Append(NewName); // make new item path CString OldPath(GetItemPath(ItemIdx)); if (RenameFile(m_hWnd, OldPath, NewPath)) { item.SetName(NewName); // update item name NMFBRENAMEITEM nmri; nmri.pszOldPath = OldPath; nmri.pszNewPath = NewPath; Notify(FBLCN_RENAMEITEM, &nmri); } } } m_LabelEdit = FALSE; *pResult = 0; }
void CAddVariableDlg::validate_data(int set_focus) { CString temp_data; CEdit *edit = (CEdit *) GetDlgItem(IDC_ADD_VARIABLE_DEFAULT_VALUE); edit->GetWindowText(temp_data); // check for 0 string length if (strlen(temp_data) == 0) { //-V805 m_data_validated = false; } else { if (m_type_number) { // verify valid number int temp_num = atoi(temp_data); char buf[TOKEN_LENGTH]; sprintf(buf, "%d", temp_num); if (stricmp(buf, temp_data)) { m_data_validated = false; } else { m_data_validated = true; } } else { m_data_validated = true; } } // Display message and reset focus if ((!m_data_validated) && (set_focus == RESET_FOCUS)) { MessageBox("Invalid Default Value."); edit->SetFocus(); edit->SetSel(0, -1); } }
// /////////////////////////////////////////////////////////////////////////// // COleDateTime CEditTime2Date( CEdit& editCtrl, const COleDateTime& date ) { CString sTime; editCtrl.GetWindowText(sTime); return SetTimeOfDate(date, sTime); }
void CAddBlogInfoDlg::OnUpdateEditBlogPassword() { CEdit *p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGPASSWORD ); p->GetWindowText( m_blogPassword ); switchMoreInfo(); }
void CNewfileDlg::OnTvnEndlabeleditTreeFiles(NMHDR *pNMHDR, LRESULT *pResult) { LPNMTVDISPINFO pTVDispInfo = reinterpret_cast<LPNMTVDISPINFO>(pNMHDR); HTREEITEM hItem = m_tree.GetSelectedItem(); if (!hItem) { *pResult = -1; return; } //CString str1 = m_pTree->GetItemText(hItem) ; CEdit* pedit = m_tree.GetEditControl(); if (!pedit) { *pResult = -1; return; } CString str1; pedit->GetWindowText(str1); if (str1.IsEmpty()) { *pResult = -1; return; } ndxml *xml = (ndxml *)m_tree.GetItemData(hItem); if (!xml) { *pResult = -1; return; } if (0 == ndxml_setattrval(xml, "name", (char*)(LPCTSTR)str1)) { m_tree.SetItemText(hItem, (LPCTSTR)str1); } *pResult = 0; }
void CAddBlogInfoDlg::OnUpdateEditBlogUserName() { CEdit *p = (CEdit *)GetDlgItem( IDC_EDIT_BLOGUSERNAME ); p->GetWindowText( m_blogUserName ); switchMoreInfo(); }
void ServerOptionsDialog::OnChangeEdit3() { CString s; CEdit* textbox = (CEdit*) GetDlgItem(IDC_EDIT3); textbox->GetWindowText(s); options.setServerDescription(s); }
int CuDlgMain::GetInstallationParam(int nSchema) { int nInstallation = -1; CRect r1, r2, re; CComboBoxEx* pComboDatabase = (nSchema == 1)? &m_cComboDatabase1: &m_cComboDatabase2; CEdit* pEditFile = (nSchema == 1)? &m_cEditFile1: &m_cEditFile2; if (pEditFile->IsWindowVisible()) { CString strFile; pEditFile->GetWindowText(strFile); strFile.TrimLeft(); strFile.TrimRight(); if (strFile.IsEmpty()) return -1; if (_taccess(strFile, 0) == -1) return -1; nInstallation = IsInstallationFile(strFile); } else { int nSel = pComboDatabase->GetCurSel(); if (nSel != CB_ERR) { CaDatabase* pDatabase = (CaDatabase*)pComboDatabase->GetItemDataPtr(nSel); if (pDatabase) { CString strDb = pDatabase->GetItem(); nInstallation = strDb.IsEmpty()? 1: 0; } } } return nInstallation; }
void ServerOptionsDialog::OnChangeEdit1() { CString s; CEdit* textbox = (CEdit*) GetDlgItem(IDC_EDIT1); textbox->GetWindowText(s); options.setServerName(s); }
void CRegisterByPhoneDialog::DoDataExchange(CDataExchange* pDX) { CBaseDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRegisterByPhoneDialog) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP if (pDX->m_bSaveAndValidate) { #ifndef NO_FREE_BONUS CString csRegistrationCode; BOOL fCodeValid = TRUE; CEdit* pCode = (CEdit*)GetDlgItem(IDC_REGISTRATION_CODE); TRY { pCode->GetWindowText(csRegistrationCode); fCodeValid = GetApp()->BonusEnableUser(csRegistrationCode, this); } END_TRY if (!fCodeValid) { pCode->SetFocus(); pCode->SetSel(0, -1); AfxThrowUserException(); } #endif }
// /////////////////////////////////////////////////////////////////////////// // COleDateTime CEditTime2AdjustedDate( CEdit& editCtrl, const COleDateTime& date ) { CString sTime; editCtrl.GetWindowText(sTime); return Time2AdjustedDate(sTime, date); }
void CStringDlg::OnChangeEnteredtext() { CString sText; CString sNew; char letter[2] = {0,0}; int i; CEdit *pEdit = (CEdit*)GetDlgItem( IDC_ENTEREDTEXT ); int selStart, selEnd; // Validate the string. pEdit->GetWindowText( sText ); for( i=0; i < sText.GetLength(); i++ ) { if( m_bAllowLetters ) { if( isalpha(sText[i]) ) { letter[0] = sText[i]; sNew += letter; } } if( m_bAllowNumbers ) { if( isdigit(sText[i]) ) { letter[0] = sText[i]; sNew += letter; } } if( m_bAllowOthers ) { if( !isdigit(sText[i]) && !isalpha(sText[i]) ) { letter[0] = sText[i]; sNew += letter; } } } if( (sNew.GetLength() != sText.GetLength()) || (sNew.GetLength() > m_MaxStringLen) ) { if( sNew.GetLength() > m_MaxStringLen ) sNew = sNew.Left(m_MaxStringLen); pEdit->GetSel( selStart, selEnd ); pEdit->SetWindowText( sNew ); pEdit->SetSel( selStart-1, selEnd-1 ); if( m_bBeeping ) MessageBeep(0); } GetDlgItem(IDOK)->EnableWindow(strlen(sNew) > 0 ? TRUE : FALSE); }
CString PreferencesDialog::getText(int id) { CEdit* edit = (CEdit*)GetDlgItem(id); CString s; if (edit) edit->GetWindowText(s); return s; }
CString CuLayoutEditDlg::GetText () { CString s; CEdit* edit = (CEdit*)GetDlgItem (IDC_RCT_EDIT1); if (edit && IsWindow (edit->m_hWnd)) edit->GetWindowText (s); return (s); }
void CTestDLGDlg::OnBnClickedBtnLogin() { CString strUserName; CString strPassword; CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT_USERNAME); pEdit->GetWindowText(strUserName); pEdit = (CEdit *)GetDlgItem(IDC_EDIT_PASSWORD); pEdit->GetWindowText(strPassword); CString strText; strText.Format(L"Username : %s. Password: %s", strUserName, strPassword); AfxMessageBox(strText); }
void CQuestionnaireButtonPage::OnOK() { CEdit *pEdit = NULL; pEdit = (CEdit *)GetDlgItem(IDC_EDIT_DELETE); if (pEdit) pEdit->GetWindowText(m_csDelete); pEdit = (CEdit *)GetDlgItem(IDC_EDIT_SEND); if (pEdit) pEdit->GetWindowText(m_csSubmit); pEdit = (CEdit *)GetDlgItem(IDC_EDIT_APPROVE); if (pEdit) pEdit->GetWindowText(m_csOk); CPropertyPage::OnOK(); }