#include "SREdit.h" #include "SRApp.h" #include using namespace SRFramework; SREdit::SREdit(void) { INITCOMMONCONTROLSEX InitCtrlEx; InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); InitCtrlEx.dwICC = ICC_TAB_CLASSES; InitCommonControlsEx(&InitCtrlEx); m_hInstance = SRFramework::SRApp::GetInstanceHandle(); m_wcsClassName = "edit"; m_wcsWindowName = ""; } SREdit::~SREdit(void) { } BOOL SREdit::Create(SRWnd *pParentWnd, RECT bounds, INT nChildID, DWORD dwStyle) { if(!Register()) return FALSE; if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName, dwStyle, bounds, pParentWnd, (HMENU)nChildID, m_hInstance)) return FALSE; return TRUE; } WCString SREdit::GetText() { TCHAR *strQuery = NULL; INT nQueryLen = ::SendMessage(m_hWnd, WM_GETTEXTLENGTH, NULL, NULL) + 1; strQuery = new TCHAR[nQueryLen]; ::SendMessage(m_hWnd,WM_GETTEXT,(WPARAM)nQueryLen,(LPARAM)strQuery); strQuery[nQueryLen - 1] = 0; // in case the buffer was exceeded return strQuery; }