// INCLUDES #define WIN32_LEAN_AND_MEAN #include <(windows.h)> #include <(windowsx.h)> #include <(mmsystem.h)> #include <(stdio.h)> #include <(stdlib.h)> #include <(math.h)> #include "header.h" // DEFINES // defines for windows #define WINDOW_CLASS_NAME "WINCLASS1" // GLOBALS int stocko=0; int allowtype=1; int typex=0; int typey=0; int xscreen = GetSystemMetrics(SM_CXSCREEN); int yscreen = GetSystemMetrics(SM_CYSCREEN); HWND main_window_handle = NULL; HINSTANCE hinstance_app = NULL; int polypoint10=0; int p0x=0,p1x=0,p2x=0,p3x=0,p4x=0,p5x=0,p6x=0,p7x=0,p8x=0,p9x=0,p10x=0,p11x=0,p12x=0,p13x=0,p14x=0,p15x=0,p16x=0,p17x=0,p18x=0,p19x=0; int p0y=0,p1y=0,p2y=0,p3y=0,p4y=0,p5y=0,p6y=0,p7y=0,p8y=0,p9y=0,p10y=0,p11y=0,p12y=0,p13y=0,p14y=0,p15y=0,p16y=0,p17y=0,p18y=0,p19y=0; int xs; char cpolypoint[80]; char cmousex[80]; char cmousey[80]; int linesize=1; char clinesize[80]; int linestartx=0; int linestarty=0; int shape=0; int colorstate=0; int dotx=0; int doty=0; char mx[80]; char my[80]; char cred[80]; char cgreen[80]; char cblue[80]; int red=1; int blue=1; int green=1; void keys(); char a='A'; char b='B'; char c='C'; char d='D'; char e='E'; char f='F'; char g='G'; char h='H'; char i='I'; char j='J'; char k='K'; char l='L'; char m='M'; char n='N'; char o='O'; char p='P'; char q='Q'; char r='R'; char s='S'; char t='T'; char u='U'; char v='V'; char w='W'; char x='X'; char y='Y'; char z='Z'; char one='1'; char two='2'; char three='3'; char four='4'; char five='5'; char six='6'; char seven='7'; char eight='8'; char nine='9'; char zero='0'; // FUNCTIONS LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { // this is the main message handler of the system PAINTSTRUCT ps; // used in WM_PAINT HDC hdc; // handle to a device context // what is the message switch(msg) { case WM_TIMER: { switch(wparam) { case IDT_TIMER_250_MILISECONDS: { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); hdc = GetDC(hwnd); HPEN blue_pen = CreatePen(PS_SOLID, 2, RGB(100, 50, 255)); HBRUSH black_brush = CreateSolidBrush(RGB(0,0,0)); SelectObject(hdc, blue_pen); SelectObject(hdc, black_brush); Rectangle(hdc, 0,yscreen-61,350,yscreen-39); }break; case IDT_TIMER_500_MILISECONDS: { allowtype=1; }break; default: break; } return (0); }break; case WM_COMMAND: { switch(LOWORD(wparam)) { case IDM_FILE_EXIT: { SendMessage(hwnd, WM_DESTROY, 0, 0); return (0); }break; case IDM_COLOR_RED0: { red=0; return (0); }break; case IDM_COLOR_GREEN0: { green=0; return (0); }break; case IDM_COLOR_BLUE0: { blue=0; return (0); }break; case IDM_OPTIONS_CLEAR: { hdc = GetDC(hwnd); RECT rect; rect.left = 0; rect.top = 0; rect.right = xscreen; rect.bottom = yscreen; HBRUSH hbrush = CreateSolidBrush(RGB(255,255,255)); FillRect(hdc,&rect,hbrush); FrameRect(hdc,&rect,hbrush); DeleteObject(hbrush); }break; case IDM_SHAPES_DOTS_SELECTDOT: { shape=0; }break; case IDM_COLOR_RAND: { colorstate=0; }break; case IDM_COLOR_CUSTOMIZE: { colorstate=1; }break; case IDM_HELP_CONTROLS: { MessageBox(NULL, "Insert: Increases red\nDelete: Decreases red\nHome: Increases green\nEnd: Decreases green\nPage Up: Increases blue\nPage Down: Decreases blue\n", "HELP ON CONTROLS", MB_OK|MB_ICONINFORMATION); }break; case IDM_HELP_ABOUT: { MessageBox(NULL, "This program is designed to let the user make pictures\nThis program is made by Jeffery L. Johnson.", "ABOUT", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_LINES_SELECT: { shape=1; }break; case IDM_SHAPES_LINES_INC: { ++linesize; }break; case IDM_SHAPES_LINES_DEC: { --linesize; }break; case IDM_SHAPES_RECTANGLES: { shape=2; }break; case IDM_SHAPES_CIRCLES_SELECT: { shape=3; }break; case IDM_SHAPES_LINES_HELP: { MessageBox(NULL, "*Left click with the mouse to get the beginning of a line.\n*Move the mouse to the point where you want the line to end and click the right mouse button.\n*To get a lot of lines from the same beginning point click the right mouse button and hold and drag it.","HELP ON LINES", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_RECTANGLES_HELP: { MessageBox(NULL, "*Left click with the mouse to get the beginning of a rectangle.\n*Move the mouse to the point where you want the rectangle to end and click the right mouse button.\n*To get a lot of rectangles from the same beginning point click the right mouse button and hold and drag it.","HELP ON RECTANGLES", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_CIRCLES_HELP: { MessageBox(NULL, "*Left click with the mouse to get the beginning of a circle.\n*Move the mouse to the point where you want the circle to end and click the right mouse button.\n*To get a lot of circles from the same beginning point click the right mouse button and hold and drag it.","HELP ON CIRCLES", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_POLYGON_SELECT: { shape=4; }break; case IDM_SHAPES_POLYGONS_HELP: { MessageBox(NULL, "*Left click with the mouse to get the beginning of a polygon.\n*Move the mouse to the point where you want the second point and click the left mouse button.\nKeep doing that until you have your polygon or you have 19 points picked.\nThen move the mouse until you have gotten to where you want the last point and click the right mouse button.\n*To get a lot of polygons from the same points click the right mouse button and hold and drag it.","HELP ON POLYGONS", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_POLYGONS_SET0: { polypoint10=0; }break; case IDM_SHAPES_TEXT_SELECT: { shape=5; }break; case IDM_SHAPES_TEXT_HELP: { MessageBox(NULL, "*Left click the mouse to get the beginning position of the text.","HELP ON TEXT", MB_OK|MB_ICONINFORMATION); }break; case IDM_FONT1: { stocko=0; }break; case IDM_FONT2: { stocko=1; }break; case IDM_FONT3: { stocko=2; }break; case IDM_FONT4: { stocko=3; }break; case IDM_FONT5: { stocko=4; }break; default: break; } return (0); }break; case WM_KEYDOWN: { int virtual_code = (int)wparam; int key_state = (int)lparam; switch(virtual_code) { case VK_DELETE: { if(red>0) { --red; } return (0); }break; case VK_INSERT: { if(red<255) { ++red; } return (0); }break; case VK_END: { if(green>0) { --green; } return (0); }break; case VK_HOME: { if(green<255) { ++green; } return (0); }break; case VK_NEXT: { if(blue>0) { --blue; } return (0); }break; case VK_PRIOR: { if(blue<255) { ++blue; } return (0); }break; default: break; } return(0); }break; case WM_MOUSEMOVE: { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); int buttons = (int)wparam; dotx=mouse_x; doty=mouse_y; hdc = GetDC(hwnd); HPEN blue_pen = CreatePen(PS_SOLID, 2, RGB(100, 50, 255)); HBRUSH black_brush = CreateSolidBrush(RGB(0,0,0)); SelectObject(hdc, blue_pen); SelectObject(hdc, black_brush); Rectangle(hdc,350,yscreen-61,xscreen,yscreen-39); SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, OPAQUE); SetTextColor(hdc, RGB(255, 0, 0)); sprintf(cmousex, "mouse x: %d", mouse_x); TextOut(hdc, 350, yscreen-58, cmousex, strlen(cmousex)); sprintf(cmousey, "mouse y: %d", mouse_y); TextOut(hdc, 450, yscreen-58, cmousey, strlen(cmousey)); if(buttons & MK_LBUTTON) { if(shape==0) { if(colorstate==0) { hdc = GetDC(hwnd); COLORREF color = RGB(rand()%256,rand()%256,rand()%256); SetPixel(hdc,dotx,doty,color); ReleaseDC(hwnd,hdc); } else if(colorstate==1) { hdc = GetDC(hwnd); COLORREF color = RGB(red,green,blue); SetPixel(hdc,dotx,doty,color); ReleaseDC(hwnd,hdc); } } else if(shape==1) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==2) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==3) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==5) { typex=mouse_x; typey=mouse_y; } } DeleteObject(blue_pen); DeleteObject(black_brush); if(buttons & MK_RBUTTON) { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); HDC hdc = GetDC(hwnd); if(shape==1) { if(colorstate==0) { HPEN green_pen = CreatePen(PS_SOLID, linesize, RGB(rand()%256, rand()%256, rand()%256)); HPEN old_pen = (HPEN)SelectObject(hdc, green_pen); MoveToEx(hdc, linestartx, linestarty, NULL); LineTo(hdc, mouse_x, mouse_y); SelectObject(hdc, old_pen); DeleteObject(green_pen); DeleteObject(old_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN green_pen2 = CreatePen(PS_SOLID, linesize, RGB(red,green,blue)); HPEN old_pen2 = (HPEN)SelectObject(hdc, green_pen2); MoveToEx(hdc, linestartx, linestarty, NULL); LineTo(hdc, mouse_x, mouse_y); SelectObject(hdc, old_pen2); DeleteObject(green_pen2); DeleteObject(old_pen2); ReleaseDC(hwnd, hdc); } } else if(shape==2) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); Rectangle(hdc, linestartx,linestarty,mouse_x,mouse_y); DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); Rectangle(hdc, linestartx,linestarty,mouse_x,mouse_y); DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } else if(shape==3) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); Ellipse(hdc,linestartx,linestarty,mouse_x,mouse_y); DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); Ellipse(hdc,linestartx,linestarty,mouse_x,mouse_y); DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } else if(shape==4) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; POINT poly[3] = {p0x,p0y,p1x,p1y,p2x,p2y}; Polygon(hdc, poly, 3); } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; POINT poly[4] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y}; Polygon(hdc, poly, 4); } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; POINT poly[5] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y}; Polygon(hdc, poly, 5); } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; POINT poly[6] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y}; Polygon(hdc, poly, 6); } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; POINT poly[7] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y}; Polygon(hdc, poly, 7); } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; POINT poly[8] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y}; Polygon(hdc, poly, 8); } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; POINT poly[9] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y}; Polygon(hdc, poly, 9); } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; POINT poly[10] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y}; Polygon(hdc, poly, 10); } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; POINT poly[11] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y}; Polygon(hdc, poly, 11); } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; POINT poly[12] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y}; Polygon(hdc, poly, 12); } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; POINT poly[13] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y}; Polygon(hdc, poly, 13); } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; POINT poly[14] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y}; Polygon(hdc, poly, 14); } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; POINT poly[15] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y}; Polygon(hdc, poly, 15); } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; POINT poly[16] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y}; Polygon(hdc, poly, 16); } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; POINT poly[17] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y}; Polygon(hdc, poly, 17); } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; POINT poly[18] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y}; Polygon(hdc, poly, 18); } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; POINT poly[19] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y}; Polygon(hdc, poly, 19); } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; POINT poly[20] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y,p19x,p19y}; Polygon(hdc, poly, 20); } DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; POINT poly[3] = {p0x,p0y,p1x,p1y,p2x,p2y}; Polygon(hdc, poly, 3); } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; POINT poly[4] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y}; Polygon(hdc, poly, 4); } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; POINT poly[5] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y}; Polygon(hdc, poly, 5); } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; POINT poly[6] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y}; Polygon(hdc, poly, 6); } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; POINT poly[7] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y}; Polygon(hdc, poly, 7); } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; POINT poly[8] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y}; Polygon(hdc, poly, 8); } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; POINT poly[9] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y}; Polygon(hdc, poly, 9); } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; POINT poly[10] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y}; Polygon(hdc, poly, 10); } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; POINT poly[11] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y}; Polygon(hdc, poly, 11); } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; POINT poly[12] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y}; Polygon(hdc, poly, 12); } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; POINT poly[13] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y}; Polygon(hdc, poly, 13); } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; POINT poly[14] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y}; Polygon(hdc, poly, 14); } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; POINT poly[15] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y}; Polygon(hdc, poly, 15); } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; POINT poly[16] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y}; Polygon(hdc, poly, 16); } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; POINT poly[17] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y}; Polygon(hdc, poly, 17); } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; POINT poly[18] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y}; Polygon(hdc, poly, 18); } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; POINT poly[19] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y}; Polygon(hdc, poly, 19); } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; POINT poly[20] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y,p19x,p19y}; Polygon(hdc, poly, 20); } DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } } return (0); }break; case WM_LBUTTONDOWN: { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); dotx=mouse_x; doty=mouse_y; HDC hdc = GetDC(hwnd); if(shape==0) { COLORREF color = RGB(red,green,blue); SetPixel(hdc,dotx,doty,color); ReleaseDC(hwnd,hdc); } else if(shape==1) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==2) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==3) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==4) { if(polypoint10==0) { p0x=mouse_x; p0y=mouse_y; ++polypoint10; } else if(polypoint10==1) { p1x=mouse_x; p1y=mouse_y; ++polypoint10; } else if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; ++polypoint10; } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; ++polypoint10; } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; ++polypoint10; } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; ++polypoint10; } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; ++polypoint10; } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; ++polypoint10; } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; ++polypoint10; } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; ++polypoint10; } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; ++polypoint10; } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; ++polypoint10; } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; ++polypoint10; } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; ++polypoint10; } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; ++polypoint10; } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; ++polypoint10; } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; ++polypoint10; } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; ++polypoint10; } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; ++polypoint10; } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; ++polypoint10; } else if(polypoint10==20) { polypoint10=19; } } else if(shape==5) { typex=mouse_x; typey=mouse_y; } return(0); }break; case WM_RBUTTONDOWN: { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); HDC hdc = GetDC(hwnd); if(shape==1) { if(colorstate==0) { HPEN green_pen = CreatePen(PS_SOLID, linesize, RGB(rand()%256, rand()%256, rand()%256)); HPEN old_pen = (HPEN)SelectObject(hdc, green_pen); MoveToEx(hdc, linestartx, linestarty, NULL); LineTo(hdc, mouse_x, mouse_y); SelectObject(hdc, old_pen); DeleteObject(green_pen); DeleteObject(old_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN green_pen2 = CreatePen(PS_SOLID, linesize, RGB(red,green,blue)); HPEN old_pen2 = (HPEN)SelectObject(hdc, green_pen2); MoveToEx(hdc, linestartx, linestarty, NULL); LineTo(hdc, mouse_x, mouse_y); SelectObject(hdc, old_pen2); DeleteObject(green_pen2); DeleteObject(old_pen2); ReleaseDC(hwnd, hdc); } } else if(shape==2) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); Rectangle(hdc, linestartx,linestarty,mouse_x,mouse_y); DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); Rectangle(hdc, linestartx,linestarty,mouse_x,mouse_y); DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } else if(shape==3) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); Ellipse(hdc,linestartx,linestarty,mouse_x,mouse_y); DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); Ellipse(hdc,linestartx,linestarty,mouse_x,mouse_y); DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } else if(shape==4) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; POINT poly[3] = {p0x,p0y,p1x,p1y,p2x,p2y}; Polygon(hdc, poly, 3); } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; POINT poly[4] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y}; Polygon(hdc, poly, 4); } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; POINT poly[5] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y}; Polygon(hdc, poly, 5); } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; POINT poly[6] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y}; Polygon(hdc, poly, 6); } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; POINT poly[7] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y}; Polygon(hdc, poly, 7); } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; POINT poly[8] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y}; Polygon(hdc, poly, 8); } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; POINT poly[9] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y}; Polygon(hdc, poly, 9); } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; POINT poly[10] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y}; Polygon(hdc, poly, 10); } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; POINT poly[11] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y}; Polygon(hdc, poly, 11); } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; POINT poly[12] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y}; Polygon(hdc, poly, 12); } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; POINT poly[13] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y}; Polygon(hdc, poly, 13); } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; POINT poly[14] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y}; Polygon(hdc, poly, 14); } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; POINT poly[15] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y}; Polygon(hdc, poly, 15); } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; POINT poly[16] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y}; Polygon(hdc, poly, 16); } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; POINT poly[17] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y}; Polygon(hdc, poly, 17); } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; POINT poly[18] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y}; Polygon(hdc, poly, 18); } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; POINT poly[19] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y}; Polygon(hdc, poly, 19); } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; POINT poly[20] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y,p19x,p19y}; Polygon(hdc, poly, 20); } DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; POINT poly[3] = {p0x,p0y,p1x,p1y,p2x,p2y}; Polygon(hdc, poly, 3); } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; POINT poly[4] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y}; Polygon(hdc, poly, 4); } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; POINT poly[5] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y}; Polygon(hdc, poly, 5); } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; POINT poly[6] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y}; Polygon(hdc, poly, 6); } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; POINT poly[7] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y}; Polygon(hdc, poly, 7); } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; POINT poly[8] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y}; Polygon(hdc, poly, 8); } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; POINT poly[9] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y}; Polygon(hdc, poly, 9); } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; POINT poly[10] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y}; Polygon(hdc, poly, 10); } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; POINT poly[11] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y}; Polygon(hdc, poly, 11); } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; POINT poly[12] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y}; Polygon(hdc, poly, 12); } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; POINT poly[13] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y}; Polygon(hdc, poly, 13); } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; POINT poly[14] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y}; Polygon(hdc, poly, 14); } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; POINT poly[15] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y}; Polygon(hdc, poly, 15); } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; POINT poly[16] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y}; Polygon(hdc, poly, 16); } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; POINT poly[17] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y}; Polygon(hdc, poly, 17); } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; POINT poly[18] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y}; Polygon(hdc, poly, 18); } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; POINT poly[19] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y}; Polygon(hdc, poly, 19); } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; POINT poly[20] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y,p19x,p19y}; Polygon(hdc, poly, 20); } DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } return(0); }break; case WM_CREATE: { SetTimer(hwnd, IDT_TIMER_250_MILISECONDS, 250, NULL); SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); return(0); } break; case WM_PAINT: { // simply validate the window hdc = BeginPaint(hwnd,&ps); // you would do all your painting here EndPaint(hwnd,&ps); // return success return(0); } break; case WM_DESTROY: { // kill the application, this sends a WM_QUIT message PostQuitMessage(0); // return success return(0); } break; default:break; } // end switch // process any messages that we didn't take care of return (DefWindowProc(hwnd, msg, wparam, lparam)); } // end WinProc // WINMAIN int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { WNDCLASSEX winclass; // this will hold the class we create HWND hwnd; // generic window handle MSG msg; HDC hdc; // generic message // first fill in the window class stucture winclass.cbSize = sizeof(WNDCLASSEX); winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; winclass.lpfnWndProc = WindowProc; winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hInstance = hinstance; winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); winclass.hCursor = LoadCursor(hinstance, MAKEINTRESOURCE(IDC_CURSOR2)); winclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); winclass.lpszMenuName = NULL; winclass.lpszClassName = WINDOW_CLASS_NAME; winclass.hIconSm = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ICON1)); // register the window class if (!RegisterClassEx(&winclass)) return(0); // create the window if (!(hwnd = CreateWindowEx(NULL, // extended style WINDOW_CLASS_NAME, // class "Moving Box", // title WS_POPUP|WS_VISIBLE|WS_DLGFRAME, 0,0, // initial x,y GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN), // initial width, height NULL, // handle to parent NULL, // handle to menu hinstance,// instance of this application NULL))) // extra creation parms return(0); main_window_handle = hwnd; // load the menu resource HMENU hmenuhandle = LoadMenu(hinstance, MAKEINTRESOURCE(IDR_MENU1)); // attach the menu to the window SetMenu(hwnd, hmenuhandle); // enter main event loop while(TRUE) { // test if there is a message in queue, if so get it if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { // test if this is a quit if (msg.message == WM_QUIT) break; // translate any accelerator keys TranslateMessage(&msg); // send the message to the window proc DispatchMessage(&msg); } // end if // main game processing goes here hdc = GetDC(hwnd); SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, OPAQUE); SetTextColor(hdc, RGB(red, 0, 0)); sprintf(cred, "Red: %d", red); TextOut(hdc, 0, yscreen-58, cred, strlen(cred)); SetTextColor(hdc, RGB(0, green, 0)); sprintf(cgreen, "Green: %d", green); TextOut(hdc, 70, yscreen-58, cgreen, strlen(cgreen)); SetTextColor(hdc, RGB(0, 0, blue)); sprintf(cblue, "Blue: %d", blue); TextOut(hdc, 150, yscreen-58, cblue, strlen(cblue)); sprintf(clinesize, "Line Size: %d", linesize); TextOut(hdc, 250, yscreen-58, clinesize, strlen(clinesize)); sprintf(cpolypoint, "Polypoint: %d", polypoint10); TextOut(hdc, 550, yscreen-58, cpolypoint, strlen(cpolypoint)); // ***Create the box.*** RECT rect; rect.left = 220; rect.top = yscreen-59; rect.right = 240; rect.bottom = yscreen-42; HBRUSH hbrush = CreateSolidBrush(RGB(red,green,blue)); FillRect(hdc,&rect,hbrush); FrameRect(hdc,&rect,hbrush); DeleteObject(hbrush); //--------------\--------------------\-------------------\---------------------\------------------ //-----------------------\--------------------\---------------------\---------------------\- if(stocko==0) { SelectObject(hdc, GetStockObject(ANSI_FIXED_FONT)); } else if(stocko==1) { SelectObject(hdc, GetStockObject(ANSI_VAR_FONT)); } else if(stocko==2) { SelectObject(hdc, GetStockObject(OEM_FIXED_FONT)); } else if(stocko==3) { SelectObject(hdc, GetStockObject(SYSTEM_FONT)); } else if(stocko==4) { SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT)); } if(KEYDOWN(a)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "A", strlen("A")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "A", strlen("A")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "a", strlen("a")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "a", strlen("a")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(b)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "B", strlen("B")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "B", strlen("B")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "b", strlen("b")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "b", strlen("b")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(c)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "C", strlen("C")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "C", strlen("C")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "c", strlen("c")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "c", strlen("c")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(d)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "D", strlen("D")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "D", strlen("D")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "d", strlen("d")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "d", strlen("d")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(e)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "E", strlen("E")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "E", strlen("E")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "e", strlen("e")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "e", strlen("e")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(f)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "F", strlen("F")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "F", strlen("F")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "f", strlen("f")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "f", strlen("f")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(g)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "G", strlen("G")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "G", strlen("G")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "g", strlen("g")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "g", strlen("g")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(h)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "H", strlen("H")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "H", strlen("H")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "h", strlen("h")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "h", strlen("h")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(i)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "I", strlen("I")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "I", strlen("I")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "i", strlen("i")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "i", strlen("i")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(j)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "J", strlen("J")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "J", strlen("J")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "j", strlen("j")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "j", strlen("j")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(k)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "K", strlen("K")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "K", strlen("K")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "k", strlen("k")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "k", strlen("k")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(l)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "L", strlen("L")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "L", strlen("L")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "l", strlen("l")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "l", strlen("l")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(m)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "M", strlen("M")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "M", strlen("M")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "m", strlen("m")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "m", strlen("m")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(n)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "N", strlen("N")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "N", strlen("N")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "n", strlen("n")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "n", strlen("n")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(o)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "O", strlen("O")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "O", strlen("O")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "o", strlen("o")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "o", strlen("o")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(p)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "P", strlen("P")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "P", strlen("P")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "p", strlen("p")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "p", strlen("p")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(q)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "Q", strlen("Q")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "Q", strlen("Q")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "q", strlen("q")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "q", strlen("q")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(r)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "R", strlen("R")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "R", strlen("R")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "r", strlen("r")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "r", strlen("r")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(s)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "S", strlen("S")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "S", strlen("S")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "s", strlen("s")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "s", strlen("s")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(t)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "T", strlen("T")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "T", strlen("T")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "t", strlen("t")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "t", strlen("t")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(u)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "U", strlen("U")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "U", strlen("U")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "u", strlen("u")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "u", strlen("u")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(v)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "V", strlen("V")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "V", strlen("V")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "v", strlen("v")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "v", strlen("v")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(w)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "W", strlen("W")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "W", strlen("W")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "w", strlen("w")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "w", strlen("w")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(x)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "X", strlen("X")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "X", strlen("X")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "x", strlen("x")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "x", strlen("x")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(y)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "Y", strlen("Y")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "Y", strlen("Y")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "y", strlen("y")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "y", strlen("y")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(z)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "Z", strlen("Z")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "Z", strlen("Z")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "z", strlen("z")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "z", strlen("z")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(zero)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "0", strlen("0")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "0", strlen("0")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(one)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "1", strlen("1")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "1", strlen("1")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(two)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "2", strlen("2")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "2", strlen("2")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(three)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "3", strlen("3")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "3", strlen("3")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(four)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "4", strlen("4")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "4", strlen("4")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(five)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "5", strlen("5")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "5", strlen("5")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(six)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "6", strlen("6")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "6", strlen("6")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(seven)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "7", strlen("7")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "7", strlen("7")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(eight)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "8", strlen("8")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "8", strlen("8")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(nine)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "9", strlen("9")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "9", strlen("9")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(VK_BACK)) { if(shape==5) { if(allowtype==1) { typex-=10; SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, OPAQUE); SetTextColor(hdc, RGB(255,255,255)); TextOut(hdc, typex, typey, "M", strlen("M")); allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } if(typex<0) { typex=xscreen-=10; typey-=20; } } } } if(KEYDOWN(VK_SPACE)) { if(shape==5) { if(allowtype==1) { typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } if(typex<0) { typex=xscreen-=10; typey-=20; } } } } SelectObject(hdc, GetStockObject(SYSTEM_FONT)); //-------------------\--------------------\--------------------\---------------------\---------------\ //----------------------------\--------------\-------------------\----------------\--------------\---- // Game_Main(); // or whatever your loop is called } // end while // return to Windows like this return(msg.wParam); } // end WinMain // INCLUDES #define WIN32_LEAN_AND_MEAN #include#include #include #include #include #include #include "header.h" // DEFINES // defines for windows #define WINDOW_CLASS_NAME "WINCLASS1" // GLOBALS int stocko=0; int allowtype=1; int typex=0; int typey=0; int xscreen = GetSystemMetrics(SM_CXSCREEN); int yscreen = GetSystemMetrics(SM_CYSCREEN); HWND main_window_handle = NULL; HINSTANCE hinstance_app = NULL; int polypoint10=0; int p0x=0,p1x=0,p2x=0,p3x=0,p4x=0,p5x=0,p6x=0,p7x=0,p8x=0,p9x=0,p10x=0,p11x=0,p12x=0,p13x=0,p14x=0,p15x=0,p16x=0,p17x=0,p18x=0,p19x=0; int p0y=0,p1y=0,p2y=0,p3y=0,p4y=0,p5y=0,p6y=0,p7y=0,p8y=0,p9y=0,p10y=0,p11y=0,p12y=0,p13y=0,p14y=0,p15y=0,p16y=0,p17y=0,p18y=0,p19y=0; int xs; char cpolypoint[80]; char cmousex[80]; char cmousey[80]; int linesize=1; char clinesize[80]; int linestartx=0; int linestarty=0; int shape=0; int colorstate=0; int dotx=0; int doty=0; char mx[80]; char my[80]; char cred[80]; char cgreen[80]; char cblue[80]; int red=1; int blue=1; int green=1; void keys(); char a='A'; char b='B'; char c='C'; char d='D'; char e='E'; char f='F'; char g='G'; char h='H'; char i='I'; char j='J'; char k='K'; char l='L'; char m='M'; char n='N'; char o='O'; char p='P'; char q='Q'; char r='R'; char s='S'; char t='T'; char u='U'; char v='V'; char w='W'; char x='X'; char y='Y'; char z='Z'; char one='1'; char two='2'; char three='3'; char four='4'; char five='5'; char six='6'; char seven='7'; char eight='8'; char nine='9'; char zero='0'; // FUNCTIONS LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { // this is the main message handler of the system PAINTSTRUCT ps; // used in WM_PAINT HDC hdc; // handle to a device context // what is the message switch(msg) { case WM_TIMER: { switch(wparam) { case IDT_TIMER_250_MILISECONDS: { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); hdc = GetDC(hwnd); HPEN blue_pen = CreatePen(PS_SOLID, 2, RGB(100, 50, 255)); HBRUSH black_brush = CreateSolidBrush(RGB(0,0,0)); SelectObject(hdc, blue_pen); SelectObject(hdc, black_brush); Rectangle(hdc, 0,yscreen-61,350,yscreen-39); }break; case IDT_TIMER_500_MILISECONDS: { allowtype=1; }break; default: break; } return (0); }break; case WM_COMMAND: { switch(LOWORD(wparam)) { case IDM_FILE_EXIT: { SendMessage(hwnd, WM_DESTROY, 0, 0); return (0); }break; case IDM_COLOR_RED0: { red=0; return (0); }break; case IDM_COLOR_GREEN0: { green=0; return (0); }break; case IDM_COLOR_BLUE0: { blue=0; return (0); }break; case IDM_OPTIONS_CLEAR: { hdc = GetDC(hwnd); RECT rect; rect.left = 0; rect.top = 0; rect.right = xscreen; rect.bottom = yscreen; HBRUSH hbrush = CreateSolidBrush(RGB(255,255,255)); FillRect(hdc,&rect,hbrush); FrameRect(hdc,&rect,hbrush); DeleteObject(hbrush); }break; case IDM_SHAPES_DOTS_SELECTDOT: { shape=0; }break; case IDM_COLOR_RAND: { colorstate=0; }break; case IDM_COLOR_CUSTOMIZE: { colorstate=1; }break; case IDM_HELP_CONTROLS: { MessageBox(NULL, "Insert: Increases red\nDelete: Decreases red\nHome: Increases green\nEnd: Decreases green\nPage Up: Increases blue\nPage Down: Decreases blue\n", "HELP ON CONTROLS", MB_OK|MB_ICONINFORMATION); }break; case IDM_HELP_ABOUT: { MessageBox(NULL, "This program is designed to let the user make pictures\nThis program is made by Jeffery L. Johnson.", "ABOUT", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_LINES_SELECT: { shape=1; }break; case IDM_SHAPES_LINES_INC: { ++linesize; }break; case IDM_SHAPES_LINES_DEC: { --linesize; }break; case IDM_SHAPES_RECTANGLES: { shape=2; }break; case IDM_SHAPES_CIRCLES_SELECT: { shape=3; }break; case IDM_SHAPES_LINES_HELP: { MessageBox(NULL, "*Left click with the mouse to get the beginning of a line.\n*Move the mouse to the point where you want the line to end and click the right mouse button.\n*To get a lot of lines from the same beginning point click the right mouse button and hold and drag it.","HELP ON LINES", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_RECTANGLES_HELP: { MessageBox(NULL, "*Left click with the mouse to get the beginning of a rectangle.\n*Move the mouse to the point where you want the rectangle to end and click the right mouse button.\n*To get a lot of rectangles from the same beginning point click the right mouse button and hold and drag it.","HELP ON RECTANGLES", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_CIRCLES_HELP: { MessageBox(NULL, "*Left click with the mouse to get the beginning of a circle.\n*Move the mouse to the point where you want the circle to end and click the right mouse button.\n*To get a lot of circles from the same beginning point click the right mouse button and hold and drag it.","HELP ON CIRCLES", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_POLYGON_SELECT: { shape=4; }break; case IDM_SHAPES_POLYGONS_HELP: { MessageBox(NULL, "*Left click with the mouse to get the beginning of a polygon.\n*Move the mouse to the point where you want the second point and click the left mouse button.\nKeep doing that until you have your polygon or you have 19 points picked.\nThen move the mouse until you have gotten to where you want the last point and click the right mouse button.\n*To get a lot of polygons from the same points click the right mouse button and hold and drag it.","HELP ON POLYGONS", MB_OK|MB_ICONINFORMATION); }break; case IDM_SHAPES_POLYGONS_SET0: { polypoint10=0; }break; case IDM_SHAPES_TEXT_SELECT: { shape=5; }break; case IDM_SHAPES_TEXT_HELP: { MessageBox(NULL, "*Left click the mouse to get the beginning position of the text.","HELP ON TEXT", MB_OK|MB_ICONINFORMATION); }break; case IDM_FONT1: { stocko=0; }break; case IDM_FONT2: { stocko=1; }break; case IDM_FONT3: { stocko=2; }break; case IDM_FONT4: { stocko=3; }break; case IDM_FONT5: { stocko=4; }break; default: break; } return (0); }break; case WM_KEYDOWN: { int virtual_code = (int)wparam; int key_state = (int)lparam; switch(virtual_code) { case VK_DELETE: { if(red>0) { --red; } return (0); }break; case VK_INSERT: { if(red<255) { ++red; } return (0); }break; case VK_END: { if(green>0) { --green; } return (0); }break; case VK_HOME: { if(green<255) { ++green; } return (0); }break; case VK_NEXT: { if(blue>0) { --blue; } return (0); }break; case VK_PRIOR: { if(blue<255) { ++blue; } return (0); }break; default: break; } return(0); }break; case WM_MOUSEMOVE: { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); int buttons = (int)wparam; dotx=mouse_x; doty=mouse_y; hdc = GetDC(hwnd); HPEN blue_pen = CreatePen(PS_SOLID, 2, RGB(100, 50, 255)); HBRUSH black_brush = CreateSolidBrush(RGB(0,0,0)); SelectObject(hdc, blue_pen); SelectObject(hdc, black_brush); Rectangle(hdc,350,yscreen-61,xscreen,yscreen-39); SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, OPAQUE); SetTextColor(hdc, RGB(255, 0, 0)); sprintf(cmousex, "mouse x: %d", mouse_x); TextOut(hdc, 350, yscreen-58, cmousex, strlen(cmousex)); sprintf(cmousey, "mouse y: %d", mouse_y); TextOut(hdc, 450, yscreen-58, cmousey, strlen(cmousey)); if(buttons & MK_LBUTTON) { if(shape==0) { if(colorstate==0) { hdc = GetDC(hwnd); COLORREF color = RGB(rand()%256,rand()%256,rand()%256); SetPixel(hdc,dotx,doty,color); ReleaseDC(hwnd,hdc); } else if(colorstate==1) { hdc = GetDC(hwnd); COLORREF color = RGB(red,green,blue); SetPixel(hdc,dotx,doty,color); ReleaseDC(hwnd,hdc); } } else if(shape==1) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==2) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==3) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==5) { typex=mouse_x; typey=mouse_y; } } DeleteObject(blue_pen); DeleteObject(black_brush); if(buttons & MK_RBUTTON) { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); HDC hdc = GetDC(hwnd); if(shape==1) { if(colorstate==0) { HPEN green_pen = CreatePen(PS_SOLID, linesize, RGB(rand()%256, rand()%256, rand()%256)); HPEN old_pen = (HPEN)SelectObject(hdc, green_pen); MoveToEx(hdc, linestartx, linestarty, NULL); LineTo(hdc, mouse_x, mouse_y); SelectObject(hdc, old_pen); DeleteObject(green_pen); DeleteObject(old_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN green_pen2 = CreatePen(PS_SOLID, linesize, RGB(red,green,blue)); HPEN old_pen2 = (HPEN)SelectObject(hdc, green_pen2); MoveToEx(hdc, linestartx, linestarty, NULL); LineTo(hdc, mouse_x, mouse_y); SelectObject(hdc, old_pen2); DeleteObject(green_pen2); DeleteObject(old_pen2); ReleaseDC(hwnd, hdc); } } else if(shape==2) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); Rectangle(hdc, linestartx,linestarty,mouse_x,mouse_y); DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); Rectangle(hdc, linestartx,linestarty,mouse_x,mouse_y); DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } else if(shape==3) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); Ellipse(hdc,linestartx,linestarty,mouse_x,mouse_y); DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); Ellipse(hdc,linestartx,linestarty,mouse_x,mouse_y); DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } else if(shape==4) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; POINT poly[3] = {p0x,p0y,p1x,p1y,p2x,p2y}; Polygon(hdc, poly, 3); } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; POINT poly[4] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y}; Polygon(hdc, poly, 4); } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; POINT poly[5] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y}; Polygon(hdc, poly, 5); } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; POINT poly[6] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y}; Polygon(hdc, poly, 6); } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; POINT poly[7] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y}; Polygon(hdc, poly, 7); } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; POINT poly[8] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y}; Polygon(hdc, poly, 8); } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; POINT poly[9] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y}; Polygon(hdc, poly, 9); } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; POINT poly[10] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y}; Polygon(hdc, poly, 10); } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; POINT poly[11] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y}; Polygon(hdc, poly, 11); } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; POINT poly[12] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y}; Polygon(hdc, poly, 12); } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; POINT poly[13] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y}; Polygon(hdc, poly, 13); } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; POINT poly[14] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y}; Polygon(hdc, poly, 14); } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; POINT poly[15] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y}; Polygon(hdc, poly, 15); } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; POINT poly[16] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y}; Polygon(hdc, poly, 16); } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; POINT poly[17] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y}; Polygon(hdc, poly, 17); } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; POINT poly[18] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y}; Polygon(hdc, poly, 18); } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; POINT poly[19] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y}; Polygon(hdc, poly, 19); } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; POINT poly[20] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y,p19x,p19y}; Polygon(hdc, poly, 20); } DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; POINT poly[3] = {p0x,p0y,p1x,p1y,p2x,p2y}; Polygon(hdc, poly, 3); } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; POINT poly[4] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y}; Polygon(hdc, poly, 4); } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; POINT poly[5] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y}; Polygon(hdc, poly, 5); } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; POINT poly[6] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y}; Polygon(hdc, poly, 6); } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; POINT poly[7] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y}; Polygon(hdc, poly, 7); } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; POINT poly[8] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y}; Polygon(hdc, poly, 8); } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; POINT poly[9] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y}; Polygon(hdc, poly, 9); } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; POINT poly[10] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y}; Polygon(hdc, poly, 10); } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; POINT poly[11] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y}; Polygon(hdc, poly, 11); } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; POINT poly[12] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y}; Polygon(hdc, poly, 12); } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; POINT poly[13] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y}; Polygon(hdc, poly, 13); } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; POINT poly[14] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y}; Polygon(hdc, poly, 14); } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; POINT poly[15] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y}; Polygon(hdc, poly, 15); } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; POINT poly[16] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y}; Polygon(hdc, poly, 16); } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; POINT poly[17] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y}; Polygon(hdc, poly, 17); } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; POINT poly[18] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y}; Polygon(hdc, poly, 18); } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; POINT poly[19] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y}; Polygon(hdc, poly, 19); } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; POINT poly[20] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y,p19x,p19y}; Polygon(hdc, poly, 20); } DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } } return (0); }break; case WM_LBUTTONDOWN: { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); dotx=mouse_x; doty=mouse_y; HDC hdc = GetDC(hwnd); if(shape==0) { COLORREF color = RGB(red,green,blue); SetPixel(hdc,dotx,doty,color); ReleaseDC(hwnd,hdc); } else if(shape==1) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==2) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==3) { linestartx=mouse_x; linestarty=mouse_y; } else if(shape==4) { if(polypoint10==0) { p0x=mouse_x; p0y=mouse_y; ++polypoint10; } else if(polypoint10==1) { p1x=mouse_x; p1y=mouse_y; ++polypoint10; } else if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; ++polypoint10; } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; ++polypoint10; } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; ++polypoint10; } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; ++polypoint10; } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; ++polypoint10; } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; ++polypoint10; } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; ++polypoint10; } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; ++polypoint10; } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; ++polypoint10; } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; ++polypoint10; } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; ++polypoint10; } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; ++polypoint10; } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; ++polypoint10; } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; ++polypoint10; } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; ++polypoint10; } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; ++polypoint10; } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; ++polypoint10; } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; ++polypoint10; } else if(polypoint10==20) { polypoint10=19; } } else if(shape==5) { typex=mouse_x; typey=mouse_y; } return(0); }break; case WM_RBUTTONDOWN: { int mouse_x = (int)LOWORD(lparam); int mouse_y = (int)HIWORD(lparam); HDC hdc = GetDC(hwnd); if(shape==1) { if(colorstate==0) { HPEN green_pen = CreatePen(PS_SOLID, linesize, RGB(rand()%256, rand()%256, rand()%256)); HPEN old_pen = (HPEN)SelectObject(hdc, green_pen); MoveToEx(hdc, linestartx, linestarty, NULL); LineTo(hdc, mouse_x, mouse_y); SelectObject(hdc, old_pen); DeleteObject(green_pen); DeleteObject(old_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN green_pen2 = CreatePen(PS_SOLID, linesize, RGB(red,green,blue)); HPEN old_pen2 = (HPEN)SelectObject(hdc, green_pen2); MoveToEx(hdc, linestartx, linestarty, NULL); LineTo(hdc, mouse_x, mouse_y); SelectObject(hdc, old_pen2); DeleteObject(green_pen2); DeleteObject(old_pen2); ReleaseDC(hwnd, hdc); } } else if(shape==2) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); Rectangle(hdc, linestartx,linestarty,mouse_x,mouse_y); DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); Rectangle(hdc, linestartx,linestarty,mouse_x,mouse_y); DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } else if(shape==3) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); Ellipse(hdc,linestartx,linestarty,mouse_x,mouse_y); DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); Ellipse(hdc,linestartx,linestarty,mouse_x,mouse_y); DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } else if(shape==4) { if(colorstate==0) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH random_brush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256)); SelectObject(hdc, random_brush); SelectObject(hdc, invisible_pen); if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; POINT poly[3] = {p0x,p0y,p1x,p1y,p2x,p2y}; Polygon(hdc, poly, 3); } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; POINT poly[4] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y}; Polygon(hdc, poly, 4); } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; POINT poly[5] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y}; Polygon(hdc, poly, 5); } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; POINT poly[6] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y}; Polygon(hdc, poly, 6); } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; POINT poly[7] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y}; Polygon(hdc, poly, 7); } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; POINT poly[8] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y}; Polygon(hdc, poly, 8); } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; POINT poly[9] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y}; Polygon(hdc, poly, 9); } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; POINT poly[10] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y}; Polygon(hdc, poly, 10); } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; POINT poly[11] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y}; Polygon(hdc, poly, 11); } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; POINT poly[12] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y}; Polygon(hdc, poly, 12); } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; POINT poly[13] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y}; Polygon(hdc, poly, 13); } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; POINT poly[14] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y}; Polygon(hdc, poly, 14); } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; POINT poly[15] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y}; Polygon(hdc, poly, 15); } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; POINT poly[16] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y}; Polygon(hdc, poly, 16); } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; POINT poly[17] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y}; Polygon(hdc, poly, 17); } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; POINT poly[18] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y}; Polygon(hdc, poly, 18); } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; POINT poly[19] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y}; Polygon(hdc, poly, 19); } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; POINT poly[20] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y,p19x,p19y}; Polygon(hdc, poly, 20); } DeleteObject(random_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } else if(colorstate==1) { HPEN invisible_pen = CreatePen(PS_NULL, 0, RGB(0,255,0)); HBRUSH custom_brush = CreateSolidBrush(RGB(red,green,blue)); SelectObject(hdc, custom_brush); SelectObject(hdc, invisible_pen); if(polypoint10==2) { p2x=mouse_x; p2y=mouse_y; POINT poly[3] = {p0x,p0y,p1x,p1y,p2x,p2y}; Polygon(hdc, poly, 3); } else if(polypoint10==3) { p3x=mouse_x; p3y=mouse_y; POINT poly[4] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y}; Polygon(hdc, poly, 4); } else if(polypoint10==4) { p4x=mouse_x; p4y=mouse_y; POINT poly[5] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y}; Polygon(hdc, poly, 5); } else if(polypoint10==5) { p5x=mouse_x; p5y=mouse_y; POINT poly[6] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y}; Polygon(hdc, poly, 6); } else if(polypoint10==6) { p6x=mouse_x; p6y=mouse_y; POINT poly[7] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y}; Polygon(hdc, poly, 7); } else if(polypoint10==7) { p7x=mouse_x; p7y=mouse_y; POINT poly[8] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y}; Polygon(hdc, poly, 8); } else if(polypoint10==8) { p8x=mouse_x; p8y=mouse_y; POINT poly[9] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y}; Polygon(hdc, poly, 9); } else if(polypoint10==9) { p9x=mouse_x; p9y=mouse_y; POINT poly[10] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y}; Polygon(hdc, poly, 10); } else if(polypoint10==10) { p10x=mouse_x; p10y=mouse_y; POINT poly[11] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y}; Polygon(hdc, poly, 11); } else if(polypoint10==11) { p11x=mouse_x; p11y=mouse_y; POINT poly[12] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y}; Polygon(hdc, poly, 12); } else if(polypoint10==12) { p12x=mouse_x; p12y=mouse_y; POINT poly[13] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y}; Polygon(hdc, poly, 13); } else if(polypoint10==13) { p13x=mouse_x; p13y=mouse_y; POINT poly[14] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y}; Polygon(hdc, poly, 14); } else if(polypoint10==14) { p14x=mouse_x; p14y=mouse_y; POINT poly[15] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y}; Polygon(hdc, poly, 15); } else if(polypoint10==15) { p15x=mouse_x; p15y=mouse_y; POINT poly[16] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y}; Polygon(hdc, poly, 16); } else if(polypoint10==16) { p16x=mouse_x; p16y=mouse_y; POINT poly[17] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y}; Polygon(hdc, poly, 17); } else if(polypoint10==17) { p17x=mouse_x; p17y=mouse_y; POINT poly[18] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y}; Polygon(hdc, poly, 18); } else if(polypoint10==18) { p18x=mouse_x; p18y=mouse_y; POINT poly[19] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y}; Polygon(hdc, poly, 19); } else if(polypoint10==19) { p19x=mouse_x; p19y=mouse_y; POINT poly[20] = {p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,p5x,p5y,p6x,p6y,p7x,p7y,p8x,p8y,p9x,p9y,p10x,p10y,p11x,p11y,p12x,p12y,p13x,p13y,p14x,p14y,p15x,p15y,p16x,p16y,p17x,p17y,p18x,p18y,p19x,p19y}; Polygon(hdc, poly, 20); } DeleteObject(custom_brush); DeleteObject(invisible_pen); ReleaseDC(hwnd, hdc); } } return(0); }break; case WM_CREATE: { SetTimer(hwnd, IDT_TIMER_250_MILISECONDS, 250, NULL); SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); return(0); } break; case WM_PAINT: { // simply validate the window hdc = BeginPaint(hwnd,&ps); // you would do all your painting here EndPaint(hwnd,&ps); // return success return(0); } break; case WM_DESTROY: { // kill the application, this sends a WM_QUIT message PostQuitMessage(0); // return success return(0); } break; default:break; } // end switch // process any messages that we didn't take care of return (DefWindowProc(hwnd, msg, wparam, lparam)); } // end WinProc // WINMAIN int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { WNDCLASSEX winclass; // this will hold the class we create HWND hwnd; // generic window handle MSG msg; HDC hdc; // generic message // first fill in the window class stucture winclass.cbSize = sizeof(WNDCLASSEX); winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; winclass.lpfnWndProc = WindowProc; winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hInstance = hinstance; winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); winclass.hCursor = LoadCursor(hinstance, MAKEINTRESOURCE(IDC_CURSOR2)); winclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); winclass.lpszMenuName = NULL; winclass.lpszClassName = WINDOW_CLASS_NAME; winclass.hIconSm = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ICON1)); // register the window class if (!RegisterClassEx(&winclass)) return(0); // create the window if (!(hwnd = CreateWindowEx(NULL, // extended style WINDOW_CLASS_NAME, // class "Moving Box", // title WS_POPUP|WS_VISIBLE|WS_DLGFRAME, 0,0, // initial x,y GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN), // initial width, height NULL, // handle to parent NULL, // handle to menu hinstance,// instance of this application NULL))) // extra creation parms return(0); main_window_handle = hwnd; // load the menu resource HMENU hmenuhandle = LoadMenu(hinstance, MAKEINTRESOURCE(IDR_MENU1)); // attach the menu to the window SetMenu(hwnd, hmenuhandle); // enter main event loop while(TRUE) { // test if there is a message in queue, if so get it if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { // test if this is a quit if (msg.message == WM_QUIT) break; // translate any accelerator keys TranslateMessage(&msg); // send the message to the window proc DispatchMessage(&msg); } // end if // main game processing goes here hdc = GetDC(hwnd); SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, OPAQUE); SetTextColor(hdc, RGB(red, 0, 0)); sprintf(cred, "Red: %d", red); TextOut(hdc, 0, yscreen-58, cred, strlen(cred)); SetTextColor(hdc, RGB(0, green, 0)); sprintf(cgreen, "Green: %d", green); TextOut(hdc, 70, yscreen-58, cgreen, strlen(cgreen)); SetTextColor(hdc, RGB(0, 0, blue)); sprintf(cblue, "Blue: %d", blue); TextOut(hdc, 150, yscreen-58, cblue, strlen(cblue)); sprintf(clinesize, "Line Size: %d", linesize); TextOut(hdc, 250, yscreen-58, clinesize, strlen(clinesize)); sprintf(cpolypoint, "Polypoint: %d", polypoint10); TextOut(hdc, 550, yscreen-58, cpolypoint, strlen(cpolypoint)); // ***Create the box.*** RECT rect; rect.left = 220; rect.top = yscreen-59; rect.right = 240; rect.bottom = yscreen-42; HBRUSH hbrush = CreateSolidBrush(RGB(red,green,blue)); FillRect(hdc,&rect,hbrush); FrameRect(hdc,&rect,hbrush); DeleteObject(hbrush); //--------------\--------------------\-------------------\---------------------\------------------ //-----------------------\--------------------\---------------------\---------------------\- if(stocko==0) { SelectObject(hdc, GetStockObject(ANSI_FIXED_FONT)); } else if(stocko==1) { SelectObject(hdc, GetStockObject(ANSI_VAR_FONT)); } else if(stocko==2) { SelectObject(hdc, GetStockObject(OEM_FIXED_FONT)); } else if(stocko==3) { SelectObject(hdc, GetStockObject(SYSTEM_FONT)); } else if(stocko==4) { SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT)); } if(KEYDOWN(a)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "A", strlen("A")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "A", strlen("A")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "a", strlen("a")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "a", strlen("a")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(b)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "B", strlen("B")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "B", strlen("B")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "b", strlen("b")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "b", strlen("b")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(c)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "C", strlen("C")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "C", strlen("C")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "c", strlen("c")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "c", strlen("c")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(d)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "D", strlen("D")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "D", strlen("D")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "d", strlen("d")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "d", strlen("d")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(e)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "E", strlen("E")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "E", strlen("E")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "e", strlen("e")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "e", strlen("e")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(f)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "F", strlen("F")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "F", strlen("F")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "f", strlen("f")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "f", strlen("f")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(g)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "G", strlen("G")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "G", strlen("G")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "g", strlen("g")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "g", strlen("g")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(h)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "H", strlen("H")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "H", strlen("H")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "h", strlen("h")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "h", strlen("h")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(i)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "I", strlen("I")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "I", strlen("I")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "i", strlen("i")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "i", strlen("i")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(j)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "J", strlen("J")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "J", strlen("J")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "j", strlen("j")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "j", strlen("j")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(k)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "K", strlen("K")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "K", strlen("K")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "k", strlen("k")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "k", strlen("k")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(l)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "L", strlen("L")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "L", strlen("L")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "l", strlen("l")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "l", strlen("l")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(m)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "M", strlen("M")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "M", strlen("M")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "m", strlen("m")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "m", strlen("m")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(n)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "N", strlen("N")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "N", strlen("N")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "n", strlen("n")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "n", strlen("n")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(o)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "O", strlen("O")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "O", strlen("O")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "o", strlen("o")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "o", strlen("o")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(p)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "P", strlen("P")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "P", strlen("P")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "p", strlen("p")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "p", strlen("p")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(q)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "Q", strlen("Q")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "Q", strlen("Q")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "q", strlen("q")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "q", strlen("q")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(r)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "R", strlen("R")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "R", strlen("R")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "r", strlen("r")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "r", strlen("r")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(s)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "S", strlen("S")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "S", strlen("S")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "s", strlen("s")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "s", strlen("s")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(t)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "T", strlen("T")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "T", strlen("T")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "t", strlen("t")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "t", strlen("t")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(u)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "U", strlen("U")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "U", strlen("U")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "u", strlen("u")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "u", strlen("u")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(v)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "V", strlen("V")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "V", strlen("V")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "v", strlen("v")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "v", strlen("v")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(w)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "W", strlen("W")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "W", strlen("W")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "w", strlen("w")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "w", strlen("w")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(x)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "X", strlen("X")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "X", strlen("X")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "x", strlen("x")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "x", strlen("x")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(y)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "Y", strlen("Y")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "Y", strlen("Y")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "y", strlen("y")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "y", strlen("y")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(z)) { if(shape==5) { if(allowtype==1) { if(KEYDOWN(VK_SHIFT)) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "Z", strlen("Z")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "Z", strlen("Z")); } } else { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "z", strlen("z")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "z", strlen("z")); } } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(zero)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "0", strlen("0")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "0", strlen("0")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(one)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "1", strlen("1")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "1", strlen("1")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(two)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "2", strlen("2")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "2", strlen("2")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(three)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "3", strlen("3")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "3", strlen("3")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(four)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "4", strlen("4")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "4", strlen("4")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(five)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "5", strlen("5")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "5", strlen("5")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(six)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "6", strlen("6")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "6", strlen("6")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(seven)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "7", strlen("7")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "7", strlen("7")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(eight)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "8", strlen("8")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "8", strlen("8")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(nine)) { if(shape==5) { if(allowtype==1) { if(colorstate==0) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(rand()%256,rand()%256,rand()%256)); TextOut(hdc, typex, typey, "9", strlen("9")); } if(colorstate==1) { SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, RGB(red, green, blue)); TextOut(hdc, typex, typey, "9", strlen("9")); } typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } } } } if(KEYDOWN(VK_BACK)) { if(shape==5) { if(allowtype==1) { typex-=10; SetBkColor(hdc, RGB(255,255,255)); SetBkMode(hdc, OPAQUE); SetTextColor(hdc, RGB(255,255,255)); TextOut(hdc, typex, typey, "M", strlen("M")); allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } if(typex<0) { typex=xscreen-=10; typey-=20; } } } } if(KEYDOWN(VK_SPACE)) { if(shape==5) { if(allowtype==1) { typex+=10; allowtype=0; SetTimer(hwnd, IDT_TIMER_500_MILISECONDS, 150, NULL); if(typex>xscreen) { typey+=20; typex=0; } if(typex<0) { typex=xscreen-=10; typey-=20; } } } } SelectObject(hdc, GetStockObject(SYSTEM_FONT)); //-------------------\--------------------\--------------------\---------------------\---------------\ //----------------------------\--------------\-------------------\----------------\--------------\---- // Game_Main(); // or whatever your loop is called } // end while // return to Windows like this return(msg.wParam); } // end WinMain ////////////////////////////////////////////////////// #define IDT_TIMER_250_MILISECONDS 1 #define IDT_TIMER_500_MILISECONDS 100 #define IDR_MENU1 101 #define IDC_CURSOR2 103 #define IDI_ICON1 104 #define IDM_FILE_EXIT 40001 #define IDM_COLOR_RED0 40003 #define IDM_COLOR_GREEN0 40004 #define IDM_COLOR_BLUE0 40005 #define IDM_OPTIONS_CLEAR 40006 #define IDM_SHAPES_DOTS_SELECTDOT 40007 #define IDM_SHAPES_DOTS_DOTRAND 40008 #define IDM_SHAPES_DOTS_DOTINIT 40009 #define IDM_HELP_CONTROLS 40011 #define IDM_HELP_ABOUT 40012 #define IDM_SHAPES_LINES_SELECT 40013 #define IDM_COLOR_RAND 40014 #define IDM_COLOR_CUSTOMIZE 40015 #define IDM_SHAPES_LINES_INC 40016 #define IDM_SHAPES_LINES_DEC 40017 #define IDM_SHAPES_RECTANGLES 40018 #define IDM_SHAPES_CIRCLES_SELECT 40019 #define IDM_SHAPES_LINES_HELP 40020 #define IDM_SHAPES_RECTANGLES_HELP 40021 #define IDM_SHAPES_CIRCLES_HELP 40022 #define IDM_SHAPES_POLYGON_SELECT 40023 #define IDM_SHAPES_POLYGONS_HELP 40024 #define IDM_SHAPES_POLYGONS_SET0 40025 #define IDM_SHAPES_TEXT_SELECT 40027 #define IDM_SHAPES_TEXT_HELP 40028 #define IDM_FONT1 40029 #define IDM_FONT2 40030 #define IDM_FONT3 40031 #define IDM_FONT4 40032 #define IDM_FONT5 40033 #define ID_COLOR 40034 #define KEYDOWN(a) ((GetAsyncKeyState(a) & 0x8000) ? 1 : 0) #define KEYDOWN(b) ((GetAsyncKeyState(b) & 0x8000) ? 1 : 0) #define KEYDOWN(c) ((GetAsyncKeyState(c) & 0x8000) ? 1 : 0) #define KEYDOWN(d) ((GetAsyncKeyState(d) & 0x8000) ? 1 : 0) #define KEYDOWN(e) ((GetAsyncKeyState(e) & 0x8000) ? 1 : 0) #define KEYDOWN(f) ((GetAsyncKeyState(f) & 0x8000) ? 1 : 0) #define KEYDOWN(g) ((GetAsyncKeyState(g) & 0x8000) ? 1 : 0) #define KEYDOWN(h) ((GetAsyncKeyState(h) & 0x8000) ? 1 : 0) #define KEYDOWN(i) ((GetAsyncKeyState(i) & 0x8000) ? 1 : 0) #define KEYDOWN(j) ((GetAsyncKeyState(j) & 0x8000) ? 1 : 0) #define KEYDOWN(k) ((GetAsyncKeyState(k) & 0x8000) ? 1 : 0) #define KEYDOWN(l) ((GetAsyncKeyState(l) & 0x8000) ? 1 : 0) #define KEYDOWN(m) ((GetAsyncKeyState(m) & 0x8000) ? 1 : 0) #define KEYDOWN(n) ((GetAsyncKeyState(n) & 0x8000) ? 1 : 0) #define KEYDOWN(o) ((GetAsyncKeyState(o) & 0x8000) ? 1 : 0) #define KEYDOWN(p) ((GetAsyncKeyState(p) & 0x8000) ? 1 : 0) #define KEYDOWN(q) ((GetAsyncKeyState(q) & 0x8000) ? 1 : 0) #define KEYDOWN(r) ((GetAsyncKeyState(r) & 0x8000) ? 1 : 0) #define KEYDOWN(s) ((GetAsyncKeyState(s) & 0x8000) ? 1 : 0) #define KEYDOWN(t) ((GetAsyncKeyState(t) & 0x8000) ? 1 : 0) #define KEYDOWN(u) ((GetAsyncKeyState(u) & 0x8000) ? 1 : 0) #define KEYDOWN(v) ((GetAsyncKeyState(v) & 0x8000) ? 1 : 0) #define KEYDOWN(w) ((GetAsyncKeyState(w) & 0x8000) ? 1 : 0) #define KEYDOWN(x) ((GetAsyncKeyState(x) & 0x8000) ? 1 : 0) #define KEYDOWN(y) ((GetAsyncKeyState(y) & 0x8000) ? 1 : 0) #define KEYDOWN(z) ((GetAsyncKeyState(z) & 0x8000) ? 1 : 0) #define KEYDOWN(one) ((GetAsyncKeyState(one) & 0x8000) ? 1 : 0) #define KEYDOWN(two) ((GetAsyncKeyState(two) & 0x8000) ? 1 : 0) #define KEYDOWN(three) ((GetAsyncKeyState(three) & 0x8000) ? 1 : 0) #define KEYDOWN(four) ((GetAsyncKeyState(four) & 0x8000) ? 1 : 0) #define KEYDOWN(five) ((GetAsyncKeyState(five) & 0x8000) ? 1 : 0) #define KEYDOWN(six) ((GetAsyncKeyState(six) & 0x8000) ? 1 : 0) #define KEYDOWN(seven) ((GetAsyncKeyState(seven) & 0x8000) ? 1 : 0) #define KEYDOWN(eight) ((GetAsyncKeyState(eight) & 0x8000) ? 1 : 0) #define KEYDOWN(nine) ((GetAsyncKeyState(nine) & 0x8000) ? 1 : 0) #define KEYDOWN(zero) ((GetAsyncKeyState(zero) & 0x8000) ? 1 : 0)