仿QQ窗口抖動

昨天晚上閒着沒事,看到了一篇技術論文,是跟珊瑚蟲版QQ有關的,其中有反編譯QQ的功能模塊,有個是QQ窗口抖動功能類,感覺還是很簡單的,代碼比較少,廢話不多說,上代碼,具體實現的exe在我的資源裏,可以自己去下載。
#include "resource.h"
#include "windows.h"



void shake(HWND hwnd)
{
	RECT rect;
	int cxWidth;
	int cyHighth;

	GetWindowRect(hwnd,&rect);

	cxWidth=rect.right-rect.left;
	cyHighth=rect.bottom-rect.top;

	for (int i=0;i<=200;i+=100)
	{
		MoveWindow(hwnd, rect.left - 5, rect.top, cxWidth, cyHighth, TRUE);
		Sleep(50);
		MoveWindow(hwnd, rect.left - 5, rect.top + 5, cxWidth, cyHighth, TRUE);
		Sleep(50);
		MoveWindow(hwnd, rect.left, rect.top + 5, cxWidth, cyHighth, TRUE);
		Sleep(50);
		MoveWindow(hwnd, rect.left, rect.top, cxWidth, cyHighth, TRUE);
		Sleep(50);

	}

	return;
}

BOOL CALLBACK control(HWND hwnd,UINT uMsg,WPARAM wparam,LPARAM lparam)
{
	if (uMsg==WM_CLOSE)
	{
		EndDialog(hwnd,0);
	}
	if (uMsg==WM_COMMAND)
	{
		if (wparam==IDOK)
		{
			shake(hwnd);
		}
	}
	


	return FALSE;
}




int APIENTRY WinMain(HINSTANCE hInstance,
					 HINSTANCE hPrevInstance,
					 LPSTR     lpCmdLine,
					 int       nCmdShow)
{
	DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),HWND_DESKTOP,control);
	return 0;
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章