Win32以编程方式禁用动画/淡入淡出

时间:2016-04-25 08:26:57

标签: winapi

我不确定该怎么做。我想禁用远程控制会话的所有动画。

但是这段代码似乎无能为力。启用动画时,它不会禁用它们。我只能通过"高级系统设置"。

禁用它们
void Anim()
    {
    BOOL bv = 0;    
    SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &bv, 0);
    if (bv)
        {
        auto a = make_tuple<int, int, int>(SPI_SETCLIENTAREAANIMATION, 0,1);
        sps.push_back(a);
        bv = 0;
        SystemParametersInfo(SPI_SETCLIENTAREAANIMATION, 0, &bv, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE) ;
        }

    SystemParametersInfo(SPI_GETMENUANIMATION, 0, &bv, 0);
    if (bv)
        {
        auto a = make_tuple<int, int, int>(SPI_SETMENUANIMATION, 0, 1);
        sps.push_back(a);
        bv = 0;
        SystemParametersInfo(SPI_SETMENUANIMATION, 0, &bv, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
        }

    ANIMATIONINFO aa;
    aa.cbSize = sizeof(aa);
    SystemParametersInfo(SPI_GETANIMATION, sizeof(aa), &aa, 0);
    if (aa.iMinAnimate != 0)
        {
        auto a = make_tuple<int, int, int>(SPI_SETANIMATION, 0, 1);
        sps.push_back(a);
        aa.cbSize = sizeof(a);
        aa.iMinAnimate = 0;
        SystemParametersInfo(SPI_SETANIMATION, sizeof(aa), &aa, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
        }
    }

这段代码应该可以恢复更改:

void AnimEnd()
    {
    for (auto& a : sps)
        {
        BOOL Vx = get<2>(a);
        if (get<0>(a) == SPI_SETANIMATION)
            {
            ANIMATIONINFO aa;
            aa.cbSize = sizeof(aa);
            aa.iMinAnimate = 1;
            SystemParametersInfo(SPI_SETANIMATION, sizeof(aa), &aa, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
            }
        else
            SystemParametersInfo(get<0>(a), get<1>(a), &Vx, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
        }
    }

0 个答案:

没有答案