QQ2006消息轰炸

很简单的实现,用了老版本的QQ2006,获取窗口句柄,循环发送消息。

高中时候写的代码,当时在网吧上网,给同学轰了过去,开始没有反应,过了一儿说刚才手机死机了。

#include 
#include 
#include 
HWND hSend;

HWND Fwnd(HWND hNext, int a)
{
	int i;
	hNext = GetWindow(hNext, GW_CHILD);
	for (i = 0; i < a; i++)
	{
		hNext = GetWindow(hNext, GW_HWNDNEXT);
		if (i == 3)
		{
			hSend = hNext;
		}
	}
	return hNext;
}

int bomb(HWND hEdit)
{
	int i, j, k, l, iTimes, iStr[32];
	char c = 48, cStr[64];

	printf("Type the words to send:\n");
	for (i = 0; c != 13; i++)
	{
		c = getche();
		cStr[i] = c;
	}
	if (i == 1)return 0;
	for (j = 0; j < i / 2; j++)
	{
		iStr[j] = MAKEWORD(cStr[2 * j + 1], cStr[2 * j]);
	}
	printf("\nType the time to send:");
	scanf("%d", &iTimes);
	for (k = 0; k < iTimes; k++)
	{
		for (l = 0; l < j; l++)
		{
			SendMessageCallback(hEdit, WM_IME_CHAR, iStr[l], 0, 0, 0);
		}
		SendMessage(hSend, BM_CLICK, 0, 0);
		Sleep(300);
	}
	printf("Already send %d times.\n", iTimes);
	return 1;
}

int main()
{
	HWND hNext;
	char wndName[16] = "与 ";
	char Name[8];

	printf("Screen name:");
	scanf("%s", &Name);
	strcat(wndName, Name);
	strcat(wndName, " 交谈中");
	hNext = FindWindow("#32770", wndName);
	if (hNext)
	{
		hNext = Fwnd(hNext, 22);
		hNext = Fwnd(hNext, 0);
		while (bomb(hNext));
	}
	return 0;
}


你可能感兴趣的:(c语言)