窗口抖动

#include 
#define SHAKE 5
void ShakeWindow()
{
    RECT rect;
    HWND hwnd=GetForegroundWindow();
    GetWindowRect(hwnd,&rect);
    MoveWindow(hwnd,rect.left+SHAKE,rect.top,rect.right-rect.left,rect.bottom-rect.top,TRUE);
    Sleep(28);
    MoveWindow(hwnd,rect.left+SHAKE,rect.top-SHAKE,rect.right-rect.left,rect.bottom-rect.top,TRUE);
    Sleep(28);
    MoveWindow(hwnd,rect.left,rect.top-SHAKE,rect.right-rect.left,rect.bottom-rect.top,TRUE);
    Sleep(28);
    MoveWindow(hwnd,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,TRUE);
}

int main()
{
    while(1)
    {
        ShakeWindow();
        Sleep(28);
    }

    return 0;
}


你可能感兴趣的:(窗口)