All pastes #480050 Raw Edit

Miscellany

public cpp v1 · immutable
·published 2007-05-10 01:39 UTC
rendered paste body
#include <windows.h>#include <stdio.h>#include <ctime>BOOL CALLBACK EnumWindowsProc( HWND _hWnd, LPARAM lParam );	HWND hWnd[255];	int idx = 0;int main( int argc, char *argv[] ) {	srand( time( 0 ) );	POINT pCursor;	BOOL bShow = TRUE;	EnumWindows( EnumWindowsProc, 0 );	while ( 1 ) {		if ( GetAsyncKeyState( VK_ESCAPE ) & 1 )			break;		else 			bShow = !bShow;		GetCursorPos( &pCursor );		for ( int i = 0; i < 255; i++ ) {			if (!hWnd[i]) continue;			RECT rWnd;			GetWindowRect( hWnd[i], &rWnd );			MoveWindow( hWnd[i], pCursor.x + (rand() % 1 ? rand() % 100 : ( rand() % 100 ) * -1),						pCursor.y + (rand() % 1 ? rand() % 100 : ( rand() % 100 ) * -1),						rWnd.right - rWnd.left, rWnd.bottom - rWnd.top, TRUE );		}	}	return 0;}BOOL CALLBACK EnumWindowsProc( HWND _hWnd, LPARAM lParam ) {	char str[255];	SetWindowText( _hWnd, "l0l hai der n0u" );	GetWindowText( _hWnd, str, 255 );	printf("Found Window: %s\n", str);	ShowWindow( _hWnd, SW_SHOW );	hWnd[idx++] = _hWnd;	return TRUE;}