首页 > 代码库 > sddsf
sddsf
1 class CWindow 2 { 3 public: 4 HWND m_hWnd; 5 6 HWND Detach() throw() 7 { 8 HWND hWnd = m_hWnd; 9 m_hWnd = NULL;10 return hWnd;11 }12 HWND Create(LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect = NULL, LPCTSTR szWindowName = NULL,13 DWORD dwStyle = 0, DWORD dwExStyle = 0,14 _U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) throw()15 {16 ATLASSUME(m_hWnd == NULL);17 if(rect.m_lpRect == NULL)18 rect.m_lpRect = &rcDefault;19 m_hWnd = ::CreateWindowEx(dwExStyle, lpstrWndClass, szWindowName,20 dwStyle, rect.m_lpRect->left, rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left,21 rect.m_lpRect->bottom - rect.m_lpRect->top, hWndParent, MenuOrID.m_hMenu,22 _AtlBaseModule.GetModuleInstance(), lpCreateParam);23 return m_hWnd;24 }25 26 BOOL DestroyWindow() throw()27 {28 ATLASSERT(::IsWindow(m_hWnd));29 30 if(!::DestroyWindow(m_hWnd))31 return FALSE;32 33 m_hWnd = NULL;34 return TRUE;35 }36 37 // Attributes38 operator HWND() const throw()39 { 40 return m_hWnd; 41 }42 DWORD GetStyle() const throw()43 {44 ATLASSERT(::IsWindow(m_hWnd));45 return (DWORD)::GetWindowLong(m_hWnd, GWL_STYLE);46 }47 48 // Message Functions49 LRESULT SendMessage(UINT message, WPARAM wParam = 0, LPARAM lParam = 0) throw()50 {51 ATLASSERT(::IsWindow(m_hWnd));52 return ::SendMessage(m_hWnd,message,wParam,lParam);53 }54 55 BOOL PostMessage(UINT message, WPARAM wParam = 0, LPARAM lParam = 0) throw()56 {57 ATLASSERT(::IsWindow(m_hWnd));58 return ::PostMessage(m_hWnd,message,wParam,lParam);59 }60 ...61 // Window Text Functions62 BOOL SetWindowText(LPCTSTR lpszString) throw()63 {64 ATLASSERT(::IsWindow(m_hWnd));65 return ::SetWindowText(m_hWnd, lpszString);66 }67 68 int GetWindowText(_Out_z_cap_post_count_(nMaxCount, return + 1) LPTSTR lpszStringBuf, _In_ int nMaxCount) const throw()69 {70 ATLASSERT(::IsWindow(m_hWnd));71 return ::GetWindowText(m_hWnd, lpszStringBuf, nMaxCount);72 }73 ...74 };75
sddsf
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。