RECT rect;
int x, y, nWidth, nHeight;
GetWindowRect(&rect);
x = rect.left;
y = rect.top;
nWidth = rect.right - x;
nHeight = rect.bottom - y;
for (int i = ; i < WINDOW_SHAKE_NUM; i++)
{
MoveWindow(x - , y, nWidth, nHeight, TRUE);
Sleep(WIN_SHAKE_SLEEP_TIME);
MoveWindow(x - , y - , nWidth, nHeight, TRUE);
Sleep(WIN_SHAKE_SLEEP_TIME);
MoveWindow(x, y - , nWidth, nHeight, TRUE);
Sleep(WIN_SHAKE_SLEEP_TIME);
MoveWindow(x, y, nWidth, nHeight, TRUE);
Sleep(WIN_SHAKE_SLEEP_TIME);
}
点击 shake! 按钮,窗口抖动起来了~
备注: WINDOW_SHAKE_NUM WIN_SHAKE_SLEEP_TIME常数宏。