/*------------------------------------------------------------------------------
Module	R:\Programmation\Projets_LCC_2005\Calculatrice\frmDlgAbout.c
Author:	valentin
Project:	Inconnu
State:		Début
Creation Date :	jeu  28 avr 2005 19:00:53
Description:	Gestion de la feuille de dialogue référencée DLG_ABOUT
--------------------------------------------------------------------------*/
#include <windows.h>
#include <stdio.h>
#include <RKControles.h>
#include "calc_rc.h"

#include "version.h"

#include "calc.h"

 /*------------------------------frmMain---------------------------------*/
extern HINSTANCE hInst;

/*Déclarations privées--------------------------------------------------*/


static int initFrmDlgAbout(HWND, WPARAM, LPARAM);
static BOOL CALLBACK gererFrmDlgAbout(HWND, UINT, WPARAM, LPARAM);
/*------------------------------------------------------------------------
Procedure:     appelDlgAbout ID:1
Purpose:
Input:
Output:
Errors:
------------------------------------------------------------------------*/
int appelDlgAbout(HWND hwndParent)
{

	/*
	* declaration des variables locales
	* =================================
	*/
	int result;
	INITCOMMONCONTROLSEX icex;


	/*
	* code executable
	* ===============
	*/
	icex.dwSize = sizeof (icex);
	icex.dwICC = 0;
	InitCommonControlsEx(&icex);

	result = DialogBoxParam(hInst, MAKEINTRESOURCE(DLG_ABOUT), hwndParent, (DLGPROC) gererFrmDlgAbout, (LPARAM)0);
	return result;
}
/*------------------------------------------------------------------------
Procedure:     initFrmDlgAboutg ID:1
Purpose:
Input:
Output:
Errors:
------------------------------------------------------------------------*/
static int initFrmDlgAbout(HWND hwndDlg, WPARAM wParam, LPARAM lParam)
{

	/*
	* declaration des variables locales
	* =================================
	*/
	char buffer[1024];
	CALC_VERSION *cv = CALC_GetVersionInfos();

	if(cv == NULL)
	{
		MessageBox(hwndDlg, "Erreur de récupération infos de version", "ERREUR", MB_ICONERROR|MB_OK);
		return 0;
	}

	SendDlgItemMessage(hwndDlg, PIC_ABOUT_LOGO, PKM_CHARGER, (WPARAM)(int)PKST_RESSOURCE, (LPARAM)(int)RCD_LOGO);

	snprintf(buffer, sizeof(buffer),
	"Calculatrice avancée\nPhidus Suite 2005\nhttp://www.phidus.net"
	"\nComposant de calcul : %s (build %i : %s %s) [Valentin KIELBASA]"
	"\nInterface utilisateur : 1.2 (build "_CBUILD_" "COMPILATION_DATE" "COMPILATION_HEURE" ) [Valentin KIELBASA]"
	"\nConseil : Sunga PATHAMMAVONG", cv->version, cv->build, cv->compileDate, cv->compileTime);

	SendDlgItemMessage(hwndDlg, LBL_ABOUT_INFO, WM_SETTEXT, (WPARAM)0, (LPARAM)buffer);

	return 1;
}
/*------------------------------------------------------------------------
Procedure:     gererFrmDlgAbout ID:1
Purpose:
Input:
Output:
Errors:
------------------------------------------------------------------------*/
static BOOL CALLBACK gererFrmDlgAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{

	/*
	* declaration des variables locales
	* =================================
	*/

	/*
	* code executable
	* ===============
	*/

	switch (msg)
	{
		case WM_INITDIALOG:
			initFrmDlgAbout(hwndDlg, wParam, lParam);
			return TRUE;
		case WM_COMMAND:
			switch (LOWORD(wParam))
		{
						case LBL_ABOUT_INFO:
				break;
			case CMD_ABOUT_OK:
				EndDialog(hwndDlg, 0);
				break;

		}
		break;
		case WM_CLOSE:
			EndDialog(hwndDlg, 0);
		return TRUE;
	}
		return FALSE;
}



