How to get text from CEdit control

CEdit is not an ATL class. Where the namespace ATLControls comes from? There is a WTL class with this name and getting text from it is easy:

    ATLASSERT(Edit.IsWindow()); // Make sure the control holds a handle
    CString sWindowText;
    Edit.GetWindowText(sWindowText);

The method GetWindowText is coming from ATL however and wraps GetWindowTextLength and GetWindowText API. The latter MSDN article also has a code snippet showing typical usage.

Since you mention that IsWindow does not work for you, the most likely problem is that your edit control wrapper class variable just does not have a handle of a real control, and hence getting text from nothing is impossible.

Tags:

C++

Cedit

Atl