cedit

How to get text from CEdit control

老子叫甜甜 提交于 2019-12-03 07:33:43
I'm a new guy with ATL. So forgive me to ask this question. Problem description: One CEdit control is added into a ATL dialog class. It's attached in the dialog initialize function. //Define the edit control ATLControls::CEdit m_txtInput; //In the OnInitDialog function m_txtInput.Attach(GetDlgItem(IDC_INPUT_LINE)); m_txtInput.SetWindowText(_T("New directory")); //In the public memeber function of the dialog GetInput() //I have tried three kinds of method to get the text. But all of them are throw an //assert exception, IsWindow() failed. //1. GetDlgItemText(IDC_INPUT_LINE, input); //2.

CEdit control maximum length? (in characters it can display)

坚强是说给别人听的谎言 提交于 2019-11-29 06:43:38
What is the maximum length for the text string contained in a CEdit control in MFC? I get a beep when trying to add a character after the character 30001 is this documented anywhere? Can I display longer texts in a CEdit? Should I use another control? As "Windows programmer" says down below, the text length limit is not the same when the user types as when we programatically set the text using SetWindowText. The limit for setting a text programatically is not mentioned anywhere. The default text lentgth limit for the user typing is wrong. (see my own post below). I'm guessing that after I call

MFC: Changing the colour of CEdit

ⅰ亾dé卋堺 提交于 2019-11-28 11:33:41
Guys, can someone give me a brief run through of how to change the background colour of a CEdit control at runtime? I want to be able to change the background to red if the field is zero length and the normal white otherwise. You cannot do it with a plain CEdit, you need to override a few bits. Implement your own ON_WM_CTLCOLOR_REFLECT handler, then return your coloured CBrush in the handler: (roughly, you'll need to put the usual resource management in there, rememebr to delete your brush in the destructor) class CColorEdit : public CEdit { .... CBrush m_brBkgnd; afx_msg HBRUSH CtlColor(CDC*

MFC: Changing the colour of CEdit

你离开我真会死。 提交于 2019-11-27 06:14:59
问题 Guys, can someone give me a brief run through of how to change the background colour of a CEdit control at runtime? I want to be able to change the background to red if the field is zero length and the normal white otherwise. 回答1: You cannot do it with a plain CEdit, you need to override a few bits. Implement your own ON_WM_CTLCOLOR_REFLECT handler, then return your coloured CBrush in the handler: (roughly, you'll need to put the usual resource management in there, rememebr to delete your