#include #include typedef unsigned char bool ; HBITMAP _logoaga,_logoprassi; /* * MainWndProc * * Purpose: * Window procedure for main window. The main window is a dialog. * */ LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_ERASEBKGND: { HDC hdc = (HDC) wParam; HPEN hpen, hpenOld ; RECT rect; GetWindowRect(hwnd,&rect); const int ysize=rect.bottom-rect.top; for (int y=rect.bottom-1; y>=rect.top; y--) { const int blu=192-int(long(y)*192/ysize); hpen = CreatePen(PS_SOLID,1,RGB(0,0,blu)); hpenOld = SelectObject(hdc, hpen); MoveTo(hdc,rect.left,y); LineTo(hdc,rect.right,y); SelectObject(hdc, hpenOld); DeleteObject(hpen); } HBITMAP hbmp=_logoaga; HBRUSH hbr, hbrPrevious; hbr = CreatePatternBrush(hbmp); UnrealizeObject(hbr); hbrPrevious = SelectObject(hdc, hbr); //PatBlt(hdc, 0, 0,200 , 200, PATCOPY); // non funziona un cazzo SelectObject(hdc, hbrPrevious); DeleteObject(hbr); } break; case WM_COMMAND: if (wParam == 1000) { ShellExecute(hwnd,"open", "setup.exe","", "eurocamp\\disk1\\", SW_SHOWNORMAL); } else if (wParam == 1001) { ShellExecute(hwnd,"open", "setup.exe","", "eurodemo\\disk1\\", SW_SHOWNORMAL); } else if (wParam == 1002) { ShellExecute(hwnd,"open", "setup.exe","", "ce\\", SW_SHOWNORMAL); } else if (wParam != 2) return 0; PostQuitMessage(0); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefDlgProc(hwnd, msg, wParam, lParam); } return NULL; } /* * InitApplication * * Purpose: * Registers window class * * Parameters: * hinst hInstance of application * * Return Value: * TRUE if initialization succeeded, FALSE otherwise. */ BOOL InitApplication (HINSTANCE hinst) { WNDCLASS wc; wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW; wc.lpfnWndProc = MainWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = DLGWINDOWEXTRA; wc.hInstance = hinst; wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_APPLICATION)); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = "MainWndClass"; return RegisterClass(&wc); } /* * WinMain * * Purpose: * Main entry point of application. * */ int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nCmdShow) { MSG msg; if (!hinstPrev) if (!InitApplication(hInst)) // Register window class return FALSE; _logoaga=LoadBitmap(hInst, MAKEINTRESOURCE(104)); _logoprassi=LoadBitmap(hInst, MAKEINTRESOURCE(105)); RECT rect; GetWindowRect(GetDesktopWindow(),&rect); HWND hwndDlg=CreateWindow("MainWndClass","Scelta installazione",WS_VISIBLE| WS_CAPTION |WS_OVERLAPPEDWINDOW , rect.left,rect.top,rect.right,rect.bottom,NULL,NULL,hInst,NULL ); // SendMessage(hwndDlg, WM_SETFONT, 8, (long)"Arial"); const int offx=(rect.right - rect.left-570)/2; const int offy=(rect.bottom - rect.top-260)/2; CreateWindow("STATIC","",WS_CHILD| WS_VISIBLE, offx+160,offy-10,410,220+10, hwndDlg ,NULL,hInst,NULL ); CreateWindow("BUTTON","Installa EuroCampo", WS_CHILD| WS_VISIBLE,offx ,offy,150,30, hwndDlg ,1000,hInst,NULL ); CreateWindow("STATIC","Installa EuroCampo in versione commerciale protetta. E' necessario disporre di una chiave di protezione hardware. ", WS_CHILD| WS_VISIBLE ,offx+170,offy,400,60, hwndDlg ,NULL,hInst,NULL ); CreateWindow("BUTTON","Installa EuroDemo", WS_CHILD| WS_VISIBLE,offx ,offy+80,150,30, hwndDlg ,1001,hInst,NULL ); CreateWindow("STATIC","Installa EuroCampo in versione Demo. La versione Demo e' priva di protezione hardware ma e' soggetta ad alcune limitazioni.", WS_CHILD| WS_VISIBLE,offx+170,offy+80,400,60, hwndDlg ,NULL,hInst,NULL ); CreateWindow("BUTTON","Installa Cespiti", WS_CHILD| WS_VISIBLE,offx ,offy+160,150,30, hwndDlg ,1002,hInst,NULL ); CreateWindow("STATIC","Installazione pacchetto ""Cespiti"". E' necessario avere installato EuroCampo con il pacchetto ""Base"".", WS_CHILD| WS_VISIBLE,offx+170,offy+160,400,60, hwndDlg ,NULL,hInst,NULL ); CreateWindow("BUTTON","Esci", WS_CHILD| WS_VISIBLE,offx,offy+240,150,30, hwndDlg ,2,hInst,NULL ); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } DeleteObject(_logoaga); DeleteObject(_logoprassi); return (msg.wParam); }