窗口抖动

来源:互联网 发布:web书籍推荐 知乎 编辑:程序博客网 时间:2024/04/28 20:44
#include <windows.h>#include <tchar.h>#include <stdio.h>VOID JitterWindow(HWND hwnd){RECT rect;int cxWidth, cyHeight, iIdx;if (!IsWindow(hwnd))return;GetWindowRect(hwnd, &rect);cxWidth = rect.right-rect.left;cyHeight = rect.bottom-rect.top;for(iIdx = 0; iIdx <= 1000; iIdx += 100){MoveWindow(hwnd, rect.left-50, rect.top, cxWidth, cyHeight, TRUE);Sleep(100);MoveWindow(hwnd, rect.left-50, rect.top + 50, cxWidth, cyHeight, TRUE);Sleep(100);MoveWindow(hwnd, rect.left, rect.top + 50, cxWidth, cyHeight, TRUE);Sleep(100);MoveWindow(hwnd, rect.left, rect.top, cxWidth, cyHeight, TRUE);Sleep(100);}return;}int main(){JitterWindow(GetForegroundWindow());getchar();getchar();return 0;}

原创粉丝点击