Accueil > > > VACCATION-WIN32 VCPP6 (MERCI À XENTOR609)
VACCATION-WIN32 VCPP6 (MERCI À XENTOR609)
Information sur la source
Description
Salut à tous,
Ce programme me sert en quelque sorte d'emploi du temps,
En effet je ne travail pas comme tout le monde, c-a-d 5 jours ouvrables
+ 1 week-end, je bosse en cycle de 8 vaccations:
1° Vaccation----> 1° Nuit
2° Vaccation----> 1° Descente de nuit
3° Vaccation----> 1° Journee
4° Vaccation----> 2° Nuit
5° Vaccation----> 2° Descente de nuit
6° Vaccation----> 2° Journee
7° Vaccation----> 1° Repos
8° Vaccation----> 2° Repos
Je l'ai déjà codé en mode console et en Javascript, les sources sont dispo sur notre site vénéré !!!
Je remercie Xentor609 pour sa patience et son aide qui m'ont bien orienté, dailleur
les bases du prog sont pompé sur une de ses sources.
Source
- /* Ce programme me sert en quelque sorte d'emploi du temps,
- En effet je ne travail pas comme tout le monde, c-a-d 5 jours ouvrables
- + 1 week-end, je bosse en cycle de 8 vaccations:
- 1° Vaccation----> 1° Nuit
- 2° Vaccation----> 1° Descente de nuit
- 3° Vaccation----> 1° Journee
- 4° Vaccation----> 2° Nuit
- 5° Vaccation----> 2° Descente de nuit
- 6° Vaccation----> 2° Journee
- 7° Vaccation----> 1° Repos
- 8° Vaccation----> 2° Repos
- */
-
- #include <windows.h>
- #include "resource.h"
-
- HINSTANCE hInst = NULL;
- HWND hwnd = NULL;
-
- //////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////
- // Declaration des Variables
-
- int nbJourDebut, nbMoisDebut, nbAnneeDebut, nbNombre;
- int nbJourFin, nbMoisFin;
- char *NomVaccation;
-
- int NumeroJour;
- char *NomJour;
-
- int nbNombreJours;
- int Fevrier;
- int MaxJours;
- int Annee2000 = 2000;
- int EcartAnnees;
- int AnneesBissextiles;
- int EcartJoursAnnees;
- int TotalJoursMois;
- int NombreDeJours;
- int Vaccation;
- long i;
- const int nbAnneeBisextile = 2000;
- bool ModeAuto=false;
-
-
- //////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////
- // Declaration des Fonctions
-
- bool AnneeBisextile (int Annee)
- {
- int Diff = abs(nbAnneeBisextile - Annee);
- int Rest = Diff % 4;
- if (!Rest) return true;
- else return false;
- }
-
- int AnneeBisextilePendant (int Annee1, int Annee2)
- {
- int ABP=0;
- int Diff = abs(Annee1 - Annee2);
- int i;
- for (i=0;i<=Diff;i++)
- {
- if (Annee1>Annee2) { if (AnneeBisextile(Annee2+i)) ABP++; }
- else { if (AnneeBisextile(Annee1+i)) ABP++; }
- }
- return ABP;
- }
-
- void RecupereTout (HWND hwnd)
- {
- char strJourDebut[3], strMoisDebut[3], strAnneeDebut[5];// strNombre[6];
-
- GetDlgItemText(hwnd,IDC_EDIT1,strJourDebut,3);
- nbJourDebut = (int) atof (strJourDebut);
-
- GetDlgItemText(hwnd,IDC_EDIT2,strMoisDebut,3);
- nbMoisDebut = (int) atof (strMoisDebut);
-
- GetDlgItemText(hwnd,IDC_EDIT3,strAnneeDebut,5);
- nbAnneeDebut = (int) atof (strAnneeDebut);
- }
-
- bool VerifieSiVide ()
- {
- if ((nbJourDebut != 0) && (nbMoisDebut != 0) && (nbAnneeDebut != 0))
- {
- return true;
- } else {
- return false;
- }
- }
-
- bool VerifieJour (HWND hwnd)
- {
- bool TorF=false;
- switch (nbMoisDebut)
- {
- case 1:
- case 3:
- case 5:
- case 7:
- case 8:
- case 10:
- case 12:
- {
- if (nbJourDebut>31)
- {
- SetDlgItemTextA (hwnd,IDC_EDIT1,"");
- MessageBox(hwnd,"Jour incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
- } else {
- TorF=true;
- }
- break;
- }
- case 4:
- case 6:
- case 9:
- case 11:
- {
- if (nbJourDebut>30)
- {
- SetDlgItemTextA (hwnd,IDC_EDIT1,"");
- MessageBox(hwnd,"Jour incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
- } else {
- TorF=true;
- }
- break;
- }
- case 2 :
- {
- if (AnneeBisextile(nbAnneeDebut))
- {
- if (nbJourDebut>29)
- {
- SetDlgItemTextA (hwnd,IDC_EDIT1,"");
- MessageBox(hwnd,"Jour incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
- } else {
- TorF=true;
- }
- } else {
- if (nbJourDebut>28)
- {
- SetDlgItemTextA (hwnd,IDC_EDIT1,"");
- MessageBox(hwnd,"Jour incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
- } else {
- TorF=true;
- }
- }
- break;
- }
- }
- return TorF;
- }
-
- bool VerifieDate (HWND hwnd)
- {
- bool TorF=false;
- if (nbAnneeDebut > 9725)
- {
- SetDlgItemTextA (hwnd,IDC_EDIT3,"");
- MessageBox(hwnd,"Vous n'avez pas le droit d'aller au-delà de 9725 !!!","Erreur !!!",MB_ICONWARNING);
- } else {
- if ((nbMoisDebut < 1) || (nbMoisDebut>12))
- {
- SetDlgItemTextA (hwnd,IDC_EDIT2,"");
- MessageBox(hwnd,"Mois incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
- } else {
- TorF=VerifieJour (hwnd);
- }
- }
- return TorF;
- }
- void CalculVaccation(HWND hwnd)
- {
-
- // Calcul du nombre total de jour entre le 1° Janvier 2000
- // et la date saisie
-
- EcartAnnees= nbAnneeDebut-Annee2000-1;
- AnneesBissextiles= (EcartAnnees / 4);
- EcartJoursAnnees= (AnneesBissextiles* 366) + ((EcartAnnees-AnneesBissextiles)*365);
-
- if ((nbAnneeDebut % 4 ) == 0)
- {Fevrier= 29;}
- else
- {Fevrier= 28;}
-
- switch (nbMoisDebut)
- {
- case 1: TotalJoursMois = 0;break;
- case 2: TotalJoursMois = 31;break;
- case 3: TotalJoursMois = 31+Fevrier;break;
- case 4: TotalJoursMois = 31+Fevrier+31;break;
- case 5: TotalJoursMois = 31+Fevrier+31+30;break;
- case 6: TotalJoursMois = 31+Fevrier+31+30+31;break;
- case 7: TotalJoursMois = 31+Fevrier+31+30+31+30;break;
- case 8: TotalJoursMois = 31+Fevrier+31+30+31+30+31;break;
- case 9: TotalJoursMois = 31+Fevrier+31+30+31+30+31+31;break;
- case 10: TotalJoursMois = 31+Fevrier+31+30+31+30+31+31+30;break;
- case 11: TotalJoursMois = 31+Fevrier+31+30+31+30+31+31+30+31;break;
- case 12: TotalJoursMois = 31+Fevrier+31+30+31+30+31+31+30+31+30;break;
- }
-
- NombreDeJours= TotalJoursMois+EcartJoursAnnees+nbJourDebut;
-
- // Calcul de la Vaccation
-
- Vaccation= NombreDeJours%8;
-
- switch (Vaccation)
- {
- case 0: NomVaccation = " Premier repos ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation); break;
- case 1: NomVaccation = " Deuxieme repos ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation); break;
- case 2: NomVaccation = " Premiere nuit ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation); break;
- case 3: NomVaccation = " Premiere descente de nuit ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
- case 4: NomVaccation = " Premiere Journee ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
- case 5: NomVaccation = " Deuxieme nuit ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
- case 6: NomVaccation = " Deuxieme descente de nuit ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
- case 7: NomVaccation = " Deuxieme Journee ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
- default: NomVaccation = " Erreur !!! ";
- SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
- }
-
- // Calcul du jour de la semaine
-
- NumeroJour= NombreDeJours%7;
-
- switch (NumeroJour)
- {
- case 0: NomJour = " Dimanche ";
- SetDlgItemText (hwnd,IDC_EDIT5,NomJour); break;
- case 1: NomJour = " Lundi ";
- SetDlgItemText (hwnd,IDC_EDIT5,NomJour); break;
- case 2: NomJour = " Mardi ";
- SetDlgItemText (hwnd,IDC_EDIT5,NomJour); break;
- case 3: NomJour = " Mercredi ";
- SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
- case 4: NomJour = " Jeudi ";
- SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
- case 5: NomJour = " Vendredi ";
- SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
- case 6: NomJour = " Samedi ";
- SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
- default: NomJour = " Erreur !!! ";
- SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
- }
-
-
- }
-
- void ActiveModeAuto (HWND hwnd)
- {
- EnableWindow ( GetDlgItem ( hwnd , IDOK ) , false ) ;
- SetWindowText( GetDlgItem ( hwnd , IDOK ) , "Automatique" ) ;
- }
-
- void DesactiveModeAuto (HWND hwnd)
- {
- ModeAuto=false;
- EnableWindow ( GetDlgItem ( hwnd , IDOK ) , true ) ;
- SetWindowText( GetDlgItem ( hwnd , IDOK ) , "&Calculer" ) ;
- }
-
-
- //////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////
- // Declaration des Procedures
-
- LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
-
- LRESULT CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- LRESULT CALLBACK DlgProc2(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
- LRESULT CALLBACK WindowProc(HWND hwnd, // Handle de la fenêtre
- UINT msg, // message du système
- WPARAM wparam, // paramètre supplémentaire
- LPARAM lparam) // paramètre supplémentaire
- {
-
- // les messages que nous ne traitons pas sont dirigés par Window
- return (DefWindowProc(hwnd, msg, wparam, lparam));
-
- }
-
- // Le gestionnaire d'évènements pour notre boîte de dialogue
- LRESULT CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
- switch(msg)
- {
- case WM_INITDIALOG:
- {
- //hIcon = LoadIcon ( hInst , MAKEINTRESOURCE ( IDI_ICON1 ) ) ;
- break;
- }
-
- // Un bouton de commande (le # du bouton est contenu dans le low 8-bit de wParam)
- case WM_COMMAND:
- {
-
- switch(LOWORD(wParam))
- {
- case IDC_EDIT1:
- case IDC_EDIT2:
- case IDC_EDIT3:
- {
- if (ModeAuto) DesactiveModeAuto(hwnd);
- break;
- }
-
- case ID_VIDETOUT:
- {
- SetDlgItemTextA (hwnd,IDC_EDIT1,"");
- SetDlgItemTextA (hwnd,IDC_EDIT2,"");
- SetDlgItemTextA (hwnd,IDC_EDIT3,"");
- SetDlgItemTextA (hwnd,IDC_EDIT4,"");
- SetDlgItemTextA (hwnd,IDC_EDIT5,"");
- break;
- }
- case IDOK:
- {
- RecupereTout(hwnd);
- if (!VerifieSiVide())
- {
- MessageBox(hwnd,"Il manque des informations !!!","Erreur !!!",MB_ICONWARNING);
- } else {
- if (VerifieDate(hwnd))
- {
- //nbNombreJours = JourMoisVersJours () + nbNombre;
- //JoursVersJourMoisAnnee();
- CalculVaccation (hwnd);
- //MontreResultat(hwnd);
- ModeAuto=true;
- ActiveModeAuto(hwnd);
- }
- }
- break;
- }
-
- // Quitter
- case ID_QUIT:
- {
- EndDialog(hwnd, FALSE);
- break;
- }
- case WM_DESTROY:
- {
- EndDialog(hwnd, FALSE);
- break;
- }
- }
- break;
- }
- default:
- return FALSE;
- }
- return TRUE;
- }
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////
- // Declaration de la Procedure principale (Win)Main
-
- int WINAPI WinMain(
- HINSTANCE hInstance, // handle sur l'instance présente
- HINSTANCE hPrevInst, // handle sur l'instance précédente (Win 3.1, obsolète)
- LPSTR lpCmdLine, // ptr sur la ligne de commande (ie: argv[], argc)
- int nCmdShow) // l'état de la fenêtre
-
- {
- // sauvegarder l'instance de notre programme
- hInst = hInstance;
- // Activer la boîte de dialogue
- DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, ( DLGPROC ) DlgProc);
-
- return (0);
- }
/* Ce programme me sert en quelque sorte d'emploi du temps,
En effet je ne travail pas comme tout le monde, c-a-d 5 jours ouvrables
+ 1 week-end, je bosse en cycle de 8 vaccations:
1° Vaccation----> 1° Nuit
2° Vaccation----> 1° Descente de nuit
3° Vaccation----> 1° Journee
4° Vaccation----> 2° Nuit
5° Vaccation----> 2° Descente de nuit
6° Vaccation----> 2° Journee
7° Vaccation----> 1° Repos
8° Vaccation----> 2° Repos
*/
#include <windows.h>
#include "resource.h"
HINSTANCE hInst = NULL;
HWND hwnd = NULL;
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// Declaration des Variables
int nbJourDebut, nbMoisDebut, nbAnneeDebut, nbNombre;
int nbJourFin, nbMoisFin;
char *NomVaccation;
int NumeroJour;
char *NomJour;
int nbNombreJours;
int Fevrier;
int MaxJours;
int Annee2000 = 2000;
int EcartAnnees;
int AnneesBissextiles;
int EcartJoursAnnees;
int TotalJoursMois;
int NombreDeJours;
int Vaccation;
long i;
const int nbAnneeBisextile = 2000;
bool ModeAuto=false;
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// Declaration des Fonctions
bool AnneeBisextile (int Annee)
{
int Diff = abs(nbAnneeBisextile - Annee);
int Rest = Diff % 4;
if (!Rest) return true;
else return false;
}
int AnneeBisextilePendant (int Annee1, int Annee2)
{
int ABP=0;
int Diff = abs(Annee1 - Annee2);
int i;
for (i=0;i<=Diff;i++)
{
if (Annee1>Annee2) { if (AnneeBisextile(Annee2+i)) ABP++; }
else { if (AnneeBisextile(Annee1+i)) ABP++; }
}
return ABP;
}
void RecupereTout (HWND hwnd)
{
char strJourDebut[3], strMoisDebut[3], strAnneeDebut[5];// strNombre[6];
GetDlgItemText(hwnd,IDC_EDIT1,strJourDebut,3);
nbJourDebut = (int) atof (strJourDebut);
GetDlgItemText(hwnd,IDC_EDIT2,strMoisDebut,3);
nbMoisDebut = (int) atof (strMoisDebut);
GetDlgItemText(hwnd,IDC_EDIT3,strAnneeDebut,5);
nbAnneeDebut = (int) atof (strAnneeDebut);
}
bool VerifieSiVide ()
{
if ((nbJourDebut != 0) && (nbMoisDebut != 0) && (nbAnneeDebut != 0))
{
return true;
} else {
return false;
}
}
bool VerifieJour (HWND hwnd)
{
bool TorF=false;
switch (nbMoisDebut)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
{
if (nbJourDebut>31)
{
SetDlgItemTextA (hwnd,IDC_EDIT1,"");
MessageBox(hwnd,"Jour incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
} else {
TorF=true;
}
break;
}
case 4:
case 6:
case 9:
case 11:
{
if (nbJourDebut>30)
{
SetDlgItemTextA (hwnd,IDC_EDIT1,"");
MessageBox(hwnd,"Jour incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
} else {
TorF=true;
}
break;
}
case 2 :
{
if (AnneeBisextile(nbAnneeDebut))
{
if (nbJourDebut>29)
{
SetDlgItemTextA (hwnd,IDC_EDIT1,"");
MessageBox(hwnd,"Jour incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
} else {
TorF=true;
}
} else {
if (nbJourDebut>28)
{
SetDlgItemTextA (hwnd,IDC_EDIT1,"");
MessageBox(hwnd,"Jour incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
} else {
TorF=true;
}
}
break;
}
}
return TorF;
}
bool VerifieDate (HWND hwnd)
{
bool TorF=false;
if (nbAnneeDebut > 9725)
{
SetDlgItemTextA (hwnd,IDC_EDIT3,"");
MessageBox(hwnd,"Vous n'avez pas le droit d'aller au-delà de 9725 !!!","Erreur !!!",MB_ICONWARNING);
} else {
if ((nbMoisDebut < 1) || (nbMoisDebut>12))
{
SetDlgItemTextA (hwnd,IDC_EDIT2,"");
MessageBox(hwnd,"Mois incorrect !!!","Erreur Date !!!",MB_ICONWARNING);
} else {
TorF=VerifieJour (hwnd);
}
}
return TorF;
}
void CalculVaccation(HWND hwnd)
{
// Calcul du nombre total de jour entre le 1° Janvier 2000
// et la date saisie
EcartAnnees= nbAnneeDebut-Annee2000-1;
AnneesBissextiles= (EcartAnnees / 4);
EcartJoursAnnees= (AnneesBissextiles* 366) + ((EcartAnnees-AnneesBissextiles)*365);
if ((nbAnneeDebut % 4 ) == 0)
{Fevrier= 29;}
else
{Fevrier= 28;}
switch (nbMoisDebut)
{
case 1: TotalJoursMois = 0;break;
case 2: TotalJoursMois = 31;break;
case 3: TotalJoursMois = 31+Fevrier;break;
case 4: TotalJoursMois = 31+Fevrier+31;break;
case 5: TotalJoursMois = 31+Fevrier+31+30;break;
case 6: TotalJoursMois = 31+Fevrier+31+30+31;break;
case 7: TotalJoursMois = 31+Fevrier+31+30+31+30;break;
case 8: TotalJoursMois = 31+Fevrier+31+30+31+30+31;break;
case 9: TotalJoursMois = 31+Fevrier+31+30+31+30+31+31;break;
case 10: TotalJoursMois = 31+Fevrier+31+30+31+30+31+31+30;break;
case 11: TotalJoursMois = 31+Fevrier+31+30+31+30+31+31+30+31;break;
case 12: TotalJoursMois = 31+Fevrier+31+30+31+30+31+31+30+31+30;break;
}
NombreDeJours= TotalJoursMois+EcartJoursAnnees+nbJourDebut;
// Calcul de la Vaccation
Vaccation= NombreDeJours%8;
switch (Vaccation)
{
case 0: NomVaccation = " Premier repos ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation); break;
case 1: NomVaccation = " Deuxieme repos ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation); break;
case 2: NomVaccation = " Premiere nuit ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation); break;
case 3: NomVaccation = " Premiere descente de nuit ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
case 4: NomVaccation = " Premiere Journee ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
case 5: NomVaccation = " Deuxieme nuit ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
case 6: NomVaccation = " Deuxieme descente de nuit ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
case 7: NomVaccation = " Deuxieme Journee ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
default: NomVaccation = " Erreur !!! ";
SetDlgItemText (hwnd,IDC_EDIT4,NomVaccation);break;
}
// Calcul du jour de la semaine
NumeroJour= NombreDeJours%7;
switch (NumeroJour)
{
case 0: NomJour = " Dimanche ";
SetDlgItemText (hwnd,IDC_EDIT5,NomJour); break;
case 1: NomJour = " Lundi ";
SetDlgItemText (hwnd,IDC_EDIT5,NomJour); break;
case 2: NomJour = " Mardi ";
SetDlgItemText (hwnd,IDC_EDIT5,NomJour); break;
case 3: NomJour = " Mercredi ";
SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
case 4: NomJour = " Jeudi ";
SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
case 5: NomJour = " Vendredi ";
SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
case 6: NomJour = " Samedi ";
SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
default: NomJour = " Erreur !!! ";
SetDlgItemText (hwnd,IDC_EDIT5,NomJour);break;
}
}
void ActiveModeAuto (HWND hwnd)
{
EnableWindow ( GetDlgItem ( hwnd , IDOK ) , false ) ;
SetWindowText( GetDlgItem ( hwnd , IDOK ) , "Automatique" ) ;
}
void DesactiveModeAuto (HWND hwnd)
{
ModeAuto=false;
EnableWindow ( GetDlgItem ( hwnd , IDOK ) , true ) ;
SetWindowText( GetDlgItem ( hwnd , IDOK ) , "&Calculer" ) ;
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// Declaration des Procedures
LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
LRESULT CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK DlgProc2(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WindowProc(HWND hwnd, // Handle de la fenêtre
UINT msg, // message du système
WPARAM wparam, // paramètre supplémentaire
LPARAM lparam) // paramètre supplémentaire
{
// les messages que nous ne traitons pas sont dirigés par Window
return (DefWindowProc(hwnd, msg, wparam, lparam));
}
// Le gestionnaire d'évènements pour notre boîte de dialogue
LRESULT CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_INITDIALOG:
{
//hIcon = LoadIcon ( hInst , MAKEINTRESOURCE ( IDI_ICON1 ) ) ;
break;
}
// Un bouton de commande (le # du bouton est contenu dans le low 8-bit de wParam)
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDC_EDIT1:
case IDC_EDIT2:
case IDC_EDIT3:
{
if (ModeAuto) DesactiveModeAuto(hwnd);
break;
}
case ID_VIDETOUT:
{
SetDlgItemTextA (hwnd,IDC_EDIT1,"");
SetDlgItemTextA (hwnd,IDC_EDIT2,"");
SetDlgItemTextA (hwnd,IDC_EDIT3,"");
SetDlgItemTextA (hwnd,IDC_EDIT4,"");
SetDlgItemTextA (hwnd,IDC_EDIT5,"");
break;
}
case IDOK:
{
RecupereTout(hwnd);
if (!VerifieSiVide())
{
MessageBox(hwnd,"Il manque des informations !!!","Erreur !!!",MB_ICONWARNING);
} else {
if (VerifieDate(hwnd))
{
//nbNombreJours = JourMoisVersJours () + nbNombre;
//JoursVersJourMoisAnnee();
CalculVaccation (hwnd);
//MontreResultat(hwnd);
ModeAuto=true;
ActiveModeAuto(hwnd);
}
}
break;
}
// Quitter
case ID_QUIT:
{
EndDialog(hwnd, FALSE);
break;
}
case WM_DESTROY:
{
EndDialog(hwnd, FALSE);
break;
}
}
break;
}
default:
return FALSE;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// Declaration de la Procedure principale (Win)Main
int WINAPI WinMain(
HINSTANCE hInstance, // handle sur l'instance présente
HINSTANCE hPrevInst, // handle sur l'instance précédente (Win 3.1, obsolète)
LPSTR lpCmdLine, // ptr sur la ligne de commande (ie: argv[], argc)
int nCmdShow) // l'état de la fenêtre
{
// sauvegarder l'instance de notre programme
hInst = hInstance;
// Activer la boîte de dialogue
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, ( DLGPROC ) DlgProc);
return (0);
}
Conclusion
J'attend vos remarques...
Merci.
depuis le 07 Juin la version donne aussi le jour de la semaine
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
IMAGINE CUP 2012, MAKE A SIGN EN FINALEIMAGINE CUP 2012, MAKE A SIGN EN FINALE par junarnoalg
Voilà qui est fait, la nouvelle est officielle ! L'équipe belge "Make a Sign" va au pays des kangourous défendre son projet dans la catégorie Software Design. http://www.imaginecup.com/CompetitionsContent/Competition/WorldwideFinalists.aspx V...
Cliquez pour lire la suite de l'article par junarnoalg KINECT 1.5 IS OUT !KINECT 1.5 IS OUT ! par Vko
La version 1.5 du Kinect For Microsoft vient tout juste de sortir ! Plein de nouveautés: Tracking de squelette en Near Mode Détection en position assise Détection faciale avec un SDK dédié Documentation et des guideline (enfin) Un out...
Cliquez pour lire la suite de l'article par Vko LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) par richardc
Mise à jour des Web API du 14 Mai
Réservez dès maintenant votre journée du 20 juin pour le Windows Azure Dev Camp 2012 à Paris
Mise à jour de Team Foundation Service
MechCommander 2 sur Windows 8
Entity Framework 5 Release Candidate e...
Cliquez pour lire la suite de l'article par richardc REACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITERREACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITER par Groc
Une mauvaise utilisation de rx lors de l'écriture d'une couche d'accès à des services peut conduire à des cas embarassants avec des erreurs mal gérées, des appels qui ne partent lorsqu'ils le devraient, et même des résultats incorrects . le tout nuis...
Cliquez pour lire la suite de l'article par Groc SHAREPOINT BLOG SITE, PROBLèME D'ARCHIVESSHAREPOINT BLOG SITE, PROBLèME D'ARCHIVES par junarnoalg
Dernièrement, nous avons migré le site
myTIC
vers un nouveau serveur SharePoint 2010. Dans les contenus que nous vouloins récupérer, nous avions un certain nombre de blogs.
Nous avons utilisé les commandes Power...
Cliquez pour lire la suite de l'article par junarnoalg
Forum
RE : SAC A DOS RE : SAC A DOS par hadjkaddour
Cliquez pour lire la suite par hadjkaddour
Logiciels
sDEVIS-FACTURES vlPRO (8.1.0.3)SDEVIS-FACTURES VLPRO (8.1.0.3)sDEVIS-FACTURES vlPRO a été mis au point pour les particuliers, créateurs, entrepreneurs, artisa... Cliquez pour télécharger sDEVIS-FACTURES vlPRO 974 Application Server (12.2.4.6)974 APPLICATION SERVER (12.2.4.6)Développez de puissantes applications dans un environnement de 'cloud computing', clusterisé, séc... Cliquez pour télécharger 974 Application Server vPicture (1.4.2.1)VPICTURE (1.4.2.1)Avec vPicture, hébergez vos images facilement et rapidement.
vPicture est un utilitaire simple, ... Cliquez pour télécharger vPicture Easy-Planning (2.2.1.6)EASY-PLANNING (2.2.1.6)Easy-Planning permet de créer des plannings sous la représentation de diagrammes et est adapté au... Cliquez pour télécharger Easy-Planning COM-BACKUP (2.0)COM-BACKUP (2.0)
COM-BACKUP est un logiciel de sauvegarde qui permet de planifier les sauvegardes de vos dossiers ...
Cliquez pour télécharger COM-BACKUP
|