m_hWnd or CAnimatedCtrl.GetSafeHWnd()? 
Author Message
 m_hWnd or CAnimatedCtrl.GetSafeHWnd()?

There is a sample program named CCmnCtrl in MSDN.This program
demonstrated how to use CAnimatedCtrl,CTreeCtrl,...,and so on.I found
that it differs at setting the styles of these controls:for
CAnimatedCtrl,it use:
        // Set the new style
        ::SetWindowLong(m_AnimateCtrl.GetSafeHwnd(), GWL_STYLE, m_dwStyle);
        // A call to SetWindowPos forces the window to re-read its style
        m_AnimateCtrl.SetWindowPos(NULL, 0, 0, m_rectAnimateCtrl.Width(),
for CTreeCtrl,it use:
        SetWindowLong(m_hWnd, GWL_STYLE, lStyleOld);
        SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |

Now you can see,they differ at the first parameter of SetWindowLong().
CTreeCtrl can use m_hWnd,it may be inherit from parent class,but
CAnimater use m_AnimatedCtrl.GetSafeHwnd() to get a HWND.I had once
use m_hWnd in place of m_AnimatedCtrl.GetSafeHwnd(),but it works not

I want to know why should feed the first parameter this way?

Sun, 11 Sep 2005 16:32:33 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Programming thread: pWnd->GetSafeHwnd() == NULL?

2. GetSafeHwnd() returns invalid handle

3. Handles, CWnd::GetSafeHwnd() and controls

4. Assertion failed ::IsWindow(m_hWnd) in SetTimer function

5. ATL ActiveX and m_hWnd

6. HWND / m_hWnd

7. Losing the m_hWnd in dialogs from callback function

8. m_hWnd

9. Help!!! with m_hWnd problem when insertin RTF

10. Why does m_hWnd gets set to NULL

11. ::SetFocus() return null with valid m_hWnd passed

12. Accessing CChildView's m_hWnd


Powered by phpBB® Forum Software