我现在用SDK写的一个应用程序,只能获得一个窗口句柄。我想实现CWnd的Invalidate函数,然后再调用一下UpdateWindow来强制的刷新窗口,那位有知道的指点一下,多谢!!!

解决方案 »

  1.   

    WM_PAINT(or WM_ERASEBKGND WM_NCPAINT)
      

  2.   

    Invalidates the entire client area of CWnd.void Invalidate(
       BOOL bErase = TRUE 
    );
    Parameters
    bErase 
    Specifies whether the background within the update region is to be erased. 
    Res
    The client area is ed for painting when the next WM_PAINT message occurs. The region can also be validated before a WM_PAINT message occurs by the ValidateRect or ValidateRgn member function.The bErase parameter specifies whether the background within the update area is to be erased when the update region is processed. If bErase is TRUE, the background is erased when the BeginPaint member function is called; if bErase is FALSE, the background remains unchanged. If bErase is TRUE for any part of the update region, the background in the entire region, not just in the given part, is erased. Windows sends a WM_PAINT message whenever the CWnd update region is not empty and there are no other messages in the application queue for that window.
      

  3.   

    Invalidate()函数产生一条WM_PAINT消息,并送入windows消息队列中,是窗口产生重画
      

  4.   

    产生WM_PAINT消息,表明区域无效,导致系统重画
      

  5.   

    1.这个窗口无效
    2.刷新背景消息(true)
    3.WM_PAINT消息
      

  6.   

    我是这样写的:
    ::PostMessage( hWnd, WM_PAINT, 0, 0 );
    ::UpdateWindow( hWnd );
    但是没有效果,郁闷
      

  7.   

    不存在无效区域你发再多的WM_PAINT也没用.
      

  8.   

    Invalidate的作用就是调用了如下APIBOOL InvalidateRect(
      HWND hWnd,  // handle of window with changed update region
      CONST RECT *lpRect,
                  // address of rectangle coordinates
      BOOL bErase // erase-background flag
    );