私はATLの新人です。ですから、この質問をすることをお許しください。
問題の説明:
1 つのCEdit
コントロールが ATL ダイアログ クラスに追加されます。ダイアログの初期化関数に添付されています。
//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.
ZeroMemory(m_lptstrInput, MAX_PATH);
m_txtInput.GetLine(0, m_lptstrInput, MAX_PATH);
//3.
BSTR input;
m_txtInput.GetWindowText(input);
テキストを取得する方法についてのトピックがありますが、機能してCEdit
いません。
CEdit
関数でコントロールにテキストを設定できるのに、関数SetWindowText()
でテキストを取得できないのはなぜGetWindowText()
ですか? それは本当に私を混乱させます。誰かが私に説明してくれたらどうもありがとう。