窗口抖动

#include 
#include 
#include 


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;
}

你可能感兴趣的:(windows编程)