QQ消息轰炸&屏幕开花代码

QQ信息自动发送

 

#include 
#include "resource.h"
#define ID_TIME  1

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")

#ifdef UNICODE
#define CF_TCHAR CF_UNICODETEXT
#else
#define CF_TCHAR CF_TEXT
#endif
TCHAR szBuffer[100];
BOOL CALLBACK DialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
HANDLE hEdit;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, DialogProc, 0);
	return 0;
}

BOOL CALLBACK DialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	int time;
	HICON hIcon;
	static HINSTANCE	hInstance	= GetModuleHandle (NULL);

	switch (message)
	{
		case WM_INITDIALOG:
			hIcon	= LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ICON1) );
			SendMessage (hDlg,WM_SETICON,ICON_BIG, (LPARAM)hIcon);

			hEdit	= GetDlgItem (hDlg, IDC_EDIT);
			SetWindowText( (HWND)hEdit, TEXT("1000") );
            //清空剪贴板
			OpenClipboard (hDlg) ;
            EmptyClipboard () ;
            CloseClipboard () ;
			return true;

		case WM_TIMER:
			keybd_event(VK_CONTROL, 0, 0, 0);
			keybd_event('V', 0, 0, 0);
			keybd_event('V', 0, 2, 0);
			keybd_event(VK_CONTROL, 0, 2, 0);

			keybd_event(VK_CONTROL, 0, 0, 0);
			keybd_event(VK_RETURN, 0, 0, 0);
			keybd_event(VK_RETURN, 0, 2, 0);
			keybd_event(VK_CONTROL, 0, 2, 0);
			return true;

		case WM_COMMAND:
			switch (LOWORD (wParam))
			{
				//case IDC_EDIT:
				//	break;

				case IDOK:
					time	= GetDlgItemInt (hDlg, IDC_EDIT, NULL, FALSE);

					if( !IsClipboardFormatAvailable (CF_TCHAR) )
					{
						MessageBox (hDlg, TEXT("剪贴板中无可用数据"), TEXT("提示"), MB_OK);
						break;
					}

					SetCursorPos(50, 450);
					mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
					SetTimer(hDlg, ID_TIME, time, NULL);
					break;

				case IDC_ABOUT:
					MessageBox (hDlg, TEXT("小K制造"), TEXT(""), MB_OK);
					break;

				case IDCANCEL:
					KillTimer(hDlg, ID_TIME);
					return true;
			}
			return true;

		case WM_CLOSE:
			KillTimer (hDlg, ID_TIME);
			EndDialog (hDlg, 0);
			return true;
	}
	return false;
}


resource.h

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by qq.rc
//
#define IDD_DIALOG                      101
#define IDR_MENU1                       102
#define IDI_ICON1                       106
#define IDC_EDIT                        1001
#define IDC_EDIT1                       1004
#define ID_40001                        40001
#define IDC_ABOUT                       40002

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        107
#define _APS_NEXT_COMMAND_VALUE         40003
#define _APS_NEXT_CONTROL_VALUE         1005
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif



 

 

 

一段好玩的代码,对桌面进行各种操作比如屏幕开玫瑰,弹头像,还可以用多媒体API附上背景音乐

自己写的更好玩点的代码丢了,就贴上这个简陋的例子

#include 

#define NUM 250

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     HDC        hdcScr, hdcMem, hdcTemp ;
     int        cx, cy ;
     HBITMAP    hBitmap, hBit ;
     HWND       hwnd ;
	 wchar_t		szFileName[10];
	 int		s, j ;

     if (LockWindowUpdate (hwnd = GetDesktopWindow ()))
     {
          hdcScr  = GetDCEx (hwnd, NULL, DCX_CACHE | DCX_LOCKWINDOWUPDATE) ;
          hdcMem  = CreateCompatibleDC (hdcScr) ;
          cx      = GetSystemMetrics (SM_CXSCREEN) ;
          cy      = GetSystemMetrics (SM_CYSCREEN) ;
          hBitmap = CreateCompatibleBitmap (hdcScr, 200, 200) ;
         
          SelectObject (hdcMem, hBitmap) ;

          srand ((int) GetCurrentTime ()) ;

		  hdcTemp	= CreateCompatibleDC (hdcScr) ;
       
          for (j = 0 ; j < NUM ; j++)
          {
				s	= rand() % 3;
				wsprintf(szFileName, L"B%d", s);
				hBit	= (HBITMAP)LoadImage (hInstance, szFileName, IMAGE_BITMAP, 200, 200, LR_DEFAULTCOLOR);
				SelectObject (hdcTemp, hBit);
				
				BitBlt (hdcMem, 0, 0, 200, 200, hdcTemp, 0, 0,SRCCOPY);

				BitBlt (hdcScr, rand() % cx, rand() % cy, cx, cy, hdcMem, 0, 0, SRCCOPY);
                Sleep (40) ;
          }
               
          DeleteDC (hdcMem) ;
          ReleaseDC (hwnd, hdcScr) ;
          DeleteObject (hBitmap) ;
             
          LockWindowUpdate (NULL) ;
     }
     return FALSE ;
}


 

你可能感兴趣的:(程序编年史)