本文整理汇总了C++中CEdit::GetWindowTextLength方法的典型用法代码示例。如果您正苦于以下问题:C++ CEdit::GetWindowTextLength方法的具体用法?C++ CEdit::GetWindowTextLength怎么用?C++ CEdit::GetWindowTextLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEdit
的用法示例。
在下文中一共展示了CEdit::GetWindowTextLength方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CCgxDlg::_append2script( TCHAR* buff )
{
CEdit* edit = (CEdit *)GetDlgItem(IDC_SCRIPT);
// get the initial text length
int nLength = edit->GetWindowTextLength();
// put the selection at the end of text
edit->SetSel(nLength, nLength);
// replace the selection
edit->ReplaceSel(buff);
nLength = edit->GetWindowTextLength();
edit->SetSel(nLength, nLength);
edit->ReplaceSel(TEXT("\n"));
}
示例2: _out
void CSystemTestDlg::_out(PTSTR pszText)
{
CEdit* edit = (CEdit*)GetDlgItem(IDC_OUT);
// get the initial text length
int nLength = edit->GetWindowTextLength();
// put the selection at the end of text
edit->SetSel(nLength, nLength);
// replace the selection
edit->ReplaceSel(pszText);
nLength = edit->GetWindowTextLength();
edit->SetSel(nLength, nLength);
edit->ReplaceSel(TEXT("\n"));
}
示例3: OnNameChanged
LRESULT CSaveArgs::OnNameChanged(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CEdit name = GetDlgItem(IDC_FILENAME);
CButton ok = GetDlgItem(IDOK);
ok.EnableWindow(name.GetWindowTextLength() > 0);
return 0;
}
示例4: AppendResult
/**
* @brief Add new result to end of result edit box.
* @param [in] result Result text to add.
*/
void CTestFilterDlg::AppendResult(CString result)
{
CEdit * edit = (CEdit *)GetDlgItem(IDC_RESULTS);
if (edit->GetWindowTextLength()>0)
result = (CString)_T("\r\n") + result;
AppendToEditBox(*edit, result);
}
示例5: WriteLog
void CyuchuandemoDlg::WriteLog(int hd,CString WriteLog)
{
CEdit *pEdit;
pEdit = (CEdit *)GetDlgItem(IDC_EDITLOG);
int nLen=0;
nLen = pEdit->GetWindowTextLength ();
pEdit->SetFocus ();
pEdit->SetSel(nLen, nLen);
if (hd==DAS_OK)
WriteLog=WriteLog+" 数据接收正常";
else if (hd==Comm_Init_Err)
WriteLog=WriteLog+" 错误原因:串口初始化错误!";
else if (hd==CommPort_Err)
WriteLog=WriteLog+" 错误原因:端口错误!";
else if (hd==CommPort_Err)
WriteLog=WriteLog+" 错误原因:端口错误!";
else if (hd==Chksum_Err)
WriteLog=WriteLog+" 错误原因:通讯数据效验错误!";
else if (hd==Rev_Data_Err)
WriteLog=WriteLog+" 错误原因:接收数据失败!";
else if (hd==TIME_OUT_Err)
WriteLog=WriteLog+" 错误原因:通讯超时错误!";
else if (hd==Para_Err)
WriteLog=WriteLog+" 错误原因:参数错误!";
else if (hd==Send_Data_Err)
WriteLog=WriteLog+" 错误原因:发送数据失败!";
else if (hd==Get_status_Err)
WriteLog=WriteLog+" 错误原因:接收状态位错误!";
else if ((hd==No_Data_Return)||(hd==No_BIN_Files)||(hd==Read_Files_ERR))
WriteLog=WriteLog+" 错误原因:没有数据返回!";
else if (hd==CRC_ERR)
WriteLog=WriteLog+" 错误原因:CRC效验错误!";
else if (hd==Rev_LEN_Err)
WriteLog=WriteLog+" 错误原因:接收长度溢出!";
else if (hd==Password_Err)
WriteLog=WriteLog+" 错误原因:授权密码错误!";
else if (hd==Password_Para_Err)
WriteLog=WriteLog+" 错误原因:密码格式错误!";
else if (hd==Encrypt_Err)
WriteLog=WriteLog+" 错误原因:数据加密错误!";
else if (hd==Wrong_DEV_Err)
WriteLog=WriteLog+" 错误原因:设备物理ID号不符!";
else if (hd==No_Record_Err)
WriteLog=WriteLog+" 错误原因:没有流水!";
else
WriteLog=WriteLog+" ";
WriteLog = WriteLog+"\r\n";
pEdit->ReplaceSel (WriteLog);
nLen = pEdit->GetLineCount();
//pEdit->LineScroll(nLen, nLen);
//pEdit->SendMessage(WM_VSCROLL, MAKEWPARAM(SB_BOTTOM,0),0);
if( nLen >= 150 )
{
pEdit->SetWindowText("");
}
}
示例6:
void CMy2DGaitRecognitionDlg::gr_write_log(CString &strLogMsg)
{
//获取当前系统时间
COleDateTime time = COleDateTime::GetCurrentTime();
CString strTime;
strTime.Format(_T("%d-%d-%d %d:%d:%d"), time.GetYear(),
time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_LOG);
pEdit->SetSel(pEdit->GetWindowTextLength(), -1);
pEdit->ReplaceSel(strTime + _T(" ") + strLogMsg + _T("\r\n"));
}
示例7: OnNMClickSyslinkDisplayPasswod
void AccountDlg::OnNMClickSyslinkDisplayPasswod(NMHDR *pNMHDR, LRESULT *pResult)
{
GetDlgItem(IDC_SYSLINK_DISPLAY_PASSWORD)->ShowWindow(SW_HIDE);
CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
edit->SetPasswordChar(0);
edit->Invalidate();
edit->SetFocus();
int nLength = edit->GetWindowTextLength();
edit->SetSel(nLength,nLength);
*pResult = 0;
}
示例8: CallWindowProc
static LRESULT CALLBACK ControlProc(HWND control, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_KEYDOWN) {
if ((LOWORD(wParam)== 'A' || LOWORD(wParam) == 'a') && GetKeyState(VK_CONTROL) < 0) {
CEdit *pEdit = (CEdit*)CWnd::FromHandle(control);
pEdit->SetSel(0, pEdit->GetWindowTextLength(), TRUE);
return 0;
}
}
return CallWindowProc(OldControlProc, control, message, wParam, lParam);
}
示例9: AppendTextToEditCtrl
static void AppendTextToEditCtrl(CEdit& edit, string text)
{
util::StringReplace(text, "\n", "\r\n");
// add CR/LF to text
CString strLine;
strLine.Format(_T("%s\r\n"), text.c_str());
// get the initial text length
int nLength = edit.GetWindowTextLength();
// put the selection at the end of text
edit.SetSel(nLength, nLength);
// replace the selection
edit.ReplaceSel(strLine);
}
示例10: CallWindowProc
static LRESULT CALLBACK ControlProc(HWND control, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_KEYDOWN) {
if (LOWORD(wParam)==VK_ESCAPE) {
return 0; // just ignore ESCAPE in edit control
}
if ((LOWORD(wParam)== 'A' || LOWORD(wParam) == 'a')
&&(GetKeyState(VK_CONTROL) < 0)) {
CEdit *pEdit = (CEdit*)CWnd::FromHandle(control);
pEdit->SetSel(0, pEdit->GetWindowTextLength(),TRUE);
return 0;
}
}
return CallWindowProc(OldControlProc, control, message, wParam, lParam); // call edit control's own windowproc
}
示例11: AddString
void CSmartCommunicationDlg::AddString(CString csAppend,bool bFlag)
{
if( m_check_stop.GetCheck()) return ;
if( csAppend.IsEmpty() ) return ;
CEdit *pEdit;
pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
int nLen=0;
nLen = pEdit->GetWindowTextLength ();
pEdit->SetFocus ();
pEdit->SetSel(nLen, nLen);
csAppend = csAppend+"\r\n";
pEdit->ReplaceSel (csAppend);
nLen = pEdit->GetLineCount();
if( nLen >= 150 )
{
pEdit->SetWindowText("");
}
}
示例12: AppendToEditBox
/**
* @brief Add text to end of edit control.
* @param [in] edit Edit contror into which the text is added.
* @param [in] text Text to add to edit control.
*/
void AppendToEditBox(CEdit & edit, LPCTSTR text)
{
int len = edit.GetWindowTextLength();
edit.SetSel(len, len);
edit.ReplaceSel(text);
}
示例13: SaveText
//type:
//0: text collector
//11: filter
//12: page
//13: img
void CTxtDropTarget::SaveText(CString str, int type)
{
CString strTime;
if (pmf->m_bOutputSaveTime)
{
SYSTEMTIME time;
::GetLocalTime(&time);
strTime.Format("[%02d/%02d-%02d:%02d:%02d] ",time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond);
}
if (type==0)
{
if (strTime.GetLength())
str = strTime + "\r\n" + str;
}
else
{
str = strTime + str;
pmf->SetMessageText(str);
}
//
str += "\r\n";
CEdit *edit;
CString strfile;
//
if (type==0)
{
edit = &(pmf->m_pCollectDlg->m_txt);
strfile = theApp.m_strUser+"CollectorText.txt";
if(pmf->m_pCollectDlg)
pmf->m_pCollectDlg->OnCollectorTxt();
}
else
{
if (type==11 && !pmf->m_bOutputSaveFilter)
return;
else if (type==12 && !pmf->m_bOutputSavePage)
return;
else if (type==13 && !pmf->m_bOutputSaveImg)
return;
else if (type==14 && !pmf->m_bOutputSaveText)
return;
else if (type==15 && !pmf->m_bOutputSaveUrlFilter)
return;
edit = &(pmf->m_pCollectDlg->m_output);
strfile = theApp.m_strUser+"CollectorOutput.txt";
if(pmf->m_pCollectDlg)
pmf->m_pCollectDlg->OnCollectorOutput();
}
//
if(pmf->m_pCollectDlg)
{
int len = edit->GetWindowTextLength( );
if (len>=MAX_COLLECTOR)
{
if (type==0)
MSGBOX(IDS_MAX_COLLECTOR_TXT);
else if (type==1)
MSGBOX(IDS_MAX_COLLECTOR_OUTPUT);
else
MSGBOX(IDS_MAX_COLLECTOR_SCRIPT);
return;
}
else
{
if (pmf->m_bCollectorAddtoBottom)
edit->SetSel(len, len);
else
edit->SetSel(0,0);
edit->ReplaceSel(str);
}
}
else
{
CFile f;
if(f.Open(strfile, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyNone))
{
f.SeekToBegin();
f.Write((void*)(LPCSTR)str, str.GetLength());
f.Close();
}
}
}
示例14: OnUpdateEditSelectAll
void CBibitemView::OnUpdateEditSelectAll(CCmdUI* pCmdUI)
{
CEdit* edit = GetFocusEdit();
pCmdUI->Enable(edit && edit->GetWindowTextLength() > 0);
}
示例15: ScrollEnd
void ExtFrame::ScrollEnd(CEdit& edit)
{
int length = edit.GetWindowTextLength();
edit.PostMessage(EM_SETSEL, length, length);
}