#include "SRLabel.h" #include "SRApp.h" #include using namespace SRFramework; SRLabel::SRLabel(const WCString &label) { m_hInstance = SRFramework::SRApp::GetInstanceHandle(); m_wcsClassName = "static"; m_wcsWindowName = label; } SRLabel::~SRLabel(void) { } BOOL SRLabel::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 SRLabel::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; } BOOL SRLabel::SetText(const WCString &label) { return ::SendMessage(m_hWnd, WM_SETTEXT, NULL, (LPARAM)label.w_str()); }