今天看MSDN无意中看到一个API  AinmateWindow可以实现动态窗口显示和消失,可是我在WM_CLOSE消息中加入AnimateWindow它并没有动态地消失 而是直接消失了  MSDN上说 你可能需要自己响应WM_PRINT和WM_PRINTCLIENT消息 请问我该怎么响应呢?另外我用GetLastError测试了  AnimateWindow根本没调用成功!
请问   这是为什么呢? 我在网上查 的,大家都用MFC 或Delphi VB实现的  我也看了 我用纯API写的差不多呀  为什么我的就不行呢? 另外在网上也找不到调用失败的例子 好像谁用谁成功  为什么我的就不成功呢?
请大家讨论一下 会是什么原因呢?  希望大家给点建议和意见   我真的很想弄明白  并且实现这个功能。

解决方案 »

  1.   

    你没有为AnimateWindow指明方向吧?试试AnimateWindow(1000, AW_HIDE|AW_SLIDE|AW_HOR_NEGATIVE);
    If the function fails, the return value is zero. The function will fail in the following situations: If the window uses the window region. Windows XP: This does not cause the function to fail.
    If the window is already visible and you are trying to show the window.
    If the window is already hidden and you are trying to hide the window.
    If there is no direction specified for the slide or roll animation.
    When trying to animate a child window with AW_BLEND. 
    If the thread does not own the window. Note that, in this case, AnimateWindow fails but GetLastError returns ERROR_SUCCESS.
      

  2.   

    问题解决了。  失败原因如下:那个AnimateWindow()函数 是我在关闭窗口的时候调用的,而如果在窗口消失的实现窗口动态 必须加上AW_HIDE参数。 在生成窗口的时候则不加AW_HIDE  
    这么一个小问题 我竟然弄了这么长时间。。