关于AnimateWindow的一个新问题,麻烦大家看下!

来源:互联网  时间:2016/7/11 9:34:01

关于网友提出的“ 关于AnimateWindow的一个新问题,麻烦大家看下!”问题疑问,本网通过在网上对“ 关于AnimateWindow的一个新问题,麻烦大家看下!”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: 关于AnimateWindow的一个新问题,麻烦大家看下!
描述:

先看看代码如下:
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.

上一篇如何将字符型数组中的字符串在文本框中显示出来
下一篇求一个填充矩形且能在上面画字的函数活一小段程序
明星图片
相关文章
《 关于AnimateWindow的一个新问题,麻烦大家看下!》由码蚁之家搜集整理于网络,
联系邮箱:mxgf168#qq.com(#改为@)