#include #include #define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0) int WINAPI WinMain(HINSTANCE hinstExe, HINSTANCE, LPSTR, int) { HWND hwnd=GetDesktopWindow(); HDC hdc=GetWindowDC(hwnd); RECT window_rect; GetWindowRect(hwnd, &window_rect); #define Y RGB(255,255,0) #define T RGB(12,124,23) COLORREF bmp[8][8]= {T,0,0,0,0,0,0,T, 0,Y,Y,Y,Y,Y,Y,0, 0,Y,0,Y,Y,0,Y,0, 0,Y,Y,Y,Y,Y,Y,0, 0,Y,0,Y,Y,0,Y,0, 0,Y,Y,0,0,Y,Y,0, 0,Y,Y,Y,Y,Y,Y,0, T,0,0,0,0,0,0,T}; #undef Y srand(GetTickCount()); MessageBox(NULL, "The following program was made by Leeran Z. Raphaely (in about 5 minutes)", "Credits ...", MB_OK); MessageBox(NULL, "How much is 1 million?", "???", MB_OK | MB_ICONQUESTION); MessageBox(NULL, "Let's find out.\n\nP.S. Press escape to stop the ride.", "!!!", MB_OK); char buffer[256]; long int i; bool esc=false; for(;;) { for(i=0; i<1000000; i++) { int gx=rand()%window_rect.right; int gy=rand()%window_rect.bottom; for(int x=0; x<8; x++) { for(int y=0; y<8; y++) { if(bmp[y][x]!=T) SetPixel(hdc, x+gx, y+gy, bmp[y][x]); } } if(KEY_DOWN(VK_ESCAPE)){esc=true; break;} sprintf(buffer, "Smilies: %d", i); TextOut(hdc, 0, 0, buffer, strlen(buffer)); } i=0; int result=MessageBox(NULL, esc?"You pressed escape! Did you mean to do this?":"Now do you know how much 1 million is?", "???", MB_YESNO | MB_ICONQUESTION); if(result==IDYES){ MessageBox(NULL, "Good for you.", "!!!", MB_OK); break; } else MessageBox(NULL, "Than try it again!!!", "!!!", MB_OK); } ReleaseDC(hwnd, hdc); return(0); }