Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 10.05 patch 502 git-svn-id: svn://10.65.10.50/trunk@8388 c028cbd2-c16b-5b4b-a496-9718f37d4682
230 lines
6.6 KiB
C++
Executable File
230 lines
6.6 KiB
C++
Executable File
#include <windows.h>
|
|
#include <shellapi.h>
|
|
#include <string.h>
|
|
|
|
typedef unsigned char bool ;
|
|
|
|
HBITMAP _logoaga,_logoprassi;
|
|
|
|
|
|
void DrawBitMap (HDC hdc, HBITMAP hb, int x, int y)
|
|
{
|
|
BITMAP bm;
|
|
HDC hdcmem;
|
|
POINT ptsize, ptorg;
|
|
|
|
hdcmem = CreateCompatibleDC(hdc);
|
|
SelectObject(hdcmem, hb);
|
|
SetMapMode(hdcmem, GetMapMode(hdc));
|
|
GetObject(hb, sizeof(BITMAP), (LPSTR)&bm);
|
|
ptsize.x = bm.bmWidth;
|
|
ptsize.y = bm.bmHeight;
|
|
ptorg.x = ptorg.y = 0;
|
|
|
|
DPtoLP(hdc, &ptorg, 1);
|
|
BitBlt(hdc, x, y, ptsize.x, ptsize.y, hdcmem, ptorg.x, ptorg.y, SRCCOPY);
|
|
DeleteDC(hdcmem);
|
|
}
|
|
|
|
/*
|
|
* 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:
|
|
{
|
|
/* Repaint lo sfondo quando necessario*/
|
|
HDC hdc = (HDC) wParam;
|
|
HPEN hpenOld = SelectObject(hdc, GetStockObject(NULL_PEN));
|
|
RECT rect; GetClientRect(hwnd,&rect);
|
|
const int ysize=rect.bottom-rect.top;
|
|
const int step = 4;
|
|
for (int y=rect.bottom; y>=rect.top-step; y-=step)
|
|
{
|
|
const int blu=192-int(long(y)*192/ysize);
|
|
HBRUSH hbrush = CreateSolidBrush(RGB(0,0,blu));
|
|
HBRUSH hbrushOld = SelectObject(hdc, hbrush);
|
|
Rectangle(hdc, rect.left, y, rect.right, y+step+1);
|
|
SelectObject(hdc, hbrushOld);
|
|
DeleteObject(hbrush);
|
|
}
|
|
SelectObject(hdc, hpenOld);
|
|
}
|
|
break;
|
|
case WM_PAINT:
|
|
{
|
|
PAINTSTRUCT ps;
|
|
RECT rct;
|
|
const char* s1 = "Installa EuroCampo in versione commerciale protetta. E' necessario disporre di una chiave di protezione hardware.";
|
|
const char* s2 = "Installa EuroCampo in versione Demo. La versione Demo è priva di protezione hardware ma soggetta ad alcune limitazioni.";
|
|
const char* s3 = "Installazione pacchetto \"Cespiti\". E' necessario avere installato EuroCampo con il pacchetto \"Base\".";
|
|
const char* s4 = "Scelta installazione";
|
|
|
|
HDC hdc = BeginPaint(hwnd, &ps);
|
|
|
|
GetWindowRect(GetDesktopWindow(),&rct);
|
|
SetBkMode(hdc, TRANSPARENT);
|
|
|
|
const int offx=(rct.right - rct.left-570)/2;
|
|
const int offy=(rct.bottom - rct.top-260)/2;
|
|
rct.left = offx+230;
|
|
rct.top = offy;
|
|
rct.right = rct.left+350;
|
|
rct.bottom = offy+60;
|
|
|
|
SetTextColor(hdc, RGB(255,255,255));
|
|
DrawText(hdc, s1, strlen(s1), &rct, DT_LEFT|DT_WORDBREAK);
|
|
rct.top += 80; rct.bottom += 80;
|
|
DrawText(hdc, s2, strlen(s2), &rct, DT_LEFT|DT_WORDBREAK);
|
|
rct.top += 80; rct.bottom += 80;
|
|
DrawText(hdc, s3, strlen(s3), &rct, DT_LEFT|DT_WORDBREAK);
|
|
|
|
|
|
/* Titolo con ombreggiatura */
|
|
HFONT hfont = CreateFont(64, 0, 0, 0, FW_BOLD, TRUE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, VARIABLE_PITCH | FF_SWISS, "Arial");
|
|
HFONT hfontOld = SelectObject(hdc, hfont);
|
|
|
|
SetTextColor(hdc, RGB(0,0,0));
|
|
TextOut(hdc, 20, 20, s4, strlen(s4));
|
|
|
|
SetTextColor(hdc, RGB(255,255,255));
|
|
TextOut(hdc, 16, 16, s4, strlen(s4));
|
|
|
|
SelectObject(hdc, hfontOld);
|
|
DeleteObject(hfont);
|
|
EndPaint(hwnd, &ps);
|
|
}
|
|
break;
|
|
case WM_COMMAND:
|
|
{
|
|
HINSTANCE ret = 10000;
|
|
if (wParam == 1000)
|
|
{
|
|
ret = WinExec("eurocamp\\disk1\\setup.exe", SW_SHOWNORMAL);
|
|
}
|
|
else if (wParam == 1001)
|
|
{
|
|
ret = WinExec("eurodemo\\disk1\\setup.exe", SW_SHOWNORMAL);
|
|
}
|
|
else if (wParam == 1002)
|
|
{
|
|
ret = WinExec("ce\\setup.exe", SW_SHOWNORMAL);
|
|
}
|
|
else if (wParam != 2)
|
|
return 0;
|
|
|
|
if (ret <= 32)
|
|
{
|
|
char s[64];
|
|
|
|
wsprintf(s,"Valore ritornato da WinExec : %d", (int)ret);
|
|
MessageBox(NULL, s, "Errore", MB_OK);
|
|
}
|
|
PostQuitMessage(0);
|
|
}
|
|
break;
|
|
case WM_CHAR:
|
|
if (wParam == VK_ESCAPE)
|
|
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(103));
|
|
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_DLGFRAME | WS_SYSMENU ,
|
|
rect.left,rect.top,rect.right,rect.bottom,NULL,NULL,hInst,NULL );
|
|
|
|
const int offx=(rect.right - rect.left-570)/2;
|
|
const int offy=(rect.bottom - rect.top-260)/2;
|
|
|
|
/* Disegna i pulsanti */
|
|
CreateWindow("BUTTON","Installa EuroCampo",
|
|
WS_CHILD| WS_VISIBLE ,offx ,offy,200,30, hwndDlg ,1000,hInst,NULL );
|
|
|
|
CreateWindow("BUTTON","Installa EuroDemo",
|
|
WS_CHILD| WS_VISIBLE ,offx ,offy+80,200,30, hwndDlg ,1001,hInst,NULL );
|
|
|
|
CreateWindow("BUTTON","Installa Cespiti",
|
|
WS_CHILD| WS_VISIBLE,offx ,offy+160,200,30, hwndDlg ,1002,hInst,NULL );
|
|
|
|
CreateWindow("BUTTON","Esci",
|
|
WS_CHILD| WS_VISIBLE,offx,offy+240,200,30, hwndDlg ,2,hInst,NULL );
|
|
|
|
while (GetMessage(&msg, NULL, 0, 0))
|
|
{
|
|
TranslateMessage(&msg);
|
|
DispatchMessage(&msg);
|
|
}
|
|
|
|
DeleteObject(_logoaga);
|
|
DeleteObject(_logoprassi);
|
|
return (msg.wParam);
|
|
}
|
|
|