每天一得:窗口转圈

#include <windows.h>

int main()
{
    int x=0, y=0;
    int status = 0;
    while (1)
    {
        if (x==0 && y==0)
        {
            status = 0;
        }
        if (x==1000 && y==0)
        {
            status = 1;
        }
        if (x==1000 && y==600)
        {
            status = 2;
        }
        if (x==0 && y == 600)
        {
            status = 3;
        }
        if (0==status)
        {
            x += 10;
        }
        if (1==status)
        {
            y += 10;
        }
        if (2==status)
        {
            x -= 10;
        }
        if (3==status)
        {
            y -= 10;
        }

        SetWindowPos((HWND)0x00050804,NULL, x, y, 500, 500, 0);
        Sleep(10);
    }
    

    return 0;
}

关键点:判断4种状态

posted on 2016-12-18 09:27  zzdoit  阅读(377)  评论(0编辑  收藏  举报

导航