先看看代码如下:hWindow = FindWindow(NULL, "窗口标题");if(hWindow != NULL)
{
AnimateWindow(hWindow, 1000, AW_BLEND | AW_HIDE);
}执行结果是,窗口确实被隐藏,GetLastError()返回0,但是没有出现渐变的效果,对此我十分奇怪,望解答。PS:
个人猜测:
1.AnimateWindow()只能针对自己创建的窗口。
2.AnimateWindow()必须在窗口创建或注销时调用。

解决方案 »

  1.   

    MSDN: The calling thread must own this window. 
      

  2.   

    MSDN中有说明:
    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.