- #include<windows.h> //pour MessageBox et MB_ICON...
- #include<stdio.h>
-
- void Menu1(void)
- {
- MessageBox (NULL, "Information", "Signification", MB_ICONINFORMATION);
- }
-
- void Menu2(void)
- {
- MessageBox (NULL, "Attention", "Signification", MB_ICONEXCLAMATION);
- }
-
- void Menu3(void)
- {
- MessageBox (NULL, "Attention (Utilise une autre dénomination)", "Signification", MB_ICONWARNING);
- }
-
- void Menu4(void)
- {
- MessageBox (NULL, "QUESTION", "Signification", MB_ICONQUESTION);
- }
-
- void Menu5(void)
- {
- MessageBox (NULL, "STOP", "Signification", MB_ICONSTOP);
- }
-
- void Menu6(void)
- {
- int VarBoite = MessageBox (NULL, "Appuyer sur un bouton", "Que faire ?", MB_YESNOCANCEL | MB_ICONQUESTION);
-
- if( VarBoite == IDYES )
- {
- printf("\nVous avez appuye sur OUI\n");
- }
-
- else if ( VarBoite == IDNO )
- {
- printf("\nVous avez appuye sur NON\n");
- }
- }
- void main(void)
- {
- int choix;
- do
- {
- printf("\nMenu :\n");
- printf("1.INFORMATION\n");
- printf("2.EXCLAMATION\n");
- printf("3.WARNING (meme icone)\n");
- printf("4.QUESTION\n");
- printf("5.STOP\n");
- printf("6.Fenetre avec boutons de choix\n");
- printf("7.Quitter\n\n");
- printf("Entrez votre choix : ");
- scanf("%d", &choix);
- if (choix == 1) Menu1();
- else if (choix == 2) Menu2();
- else if (choix == 3) Menu3();
- else if (choix == 4) Menu4();
- else if (choix == 5) Menu5();
- else if (choix == 6) Menu6();
- }
-
- while (choix !=7);
- }
-
-
- /*Récapitulatif
-
-
- MessageBox (NULL, "Texte", "En tete", MB_ICON...);
-
-
-
- Icones :
-
- MB_ICONEXCLAMATION
- ou MB_ICONWARNING Point d'exclamation (Attention)
-
- MB_ICONINFORMATION un I dans un cercle (Information)
- MB_ICONQUESTION Point d'interrogation (Question)
- MB_ICONSTOP Croix dans un cercke rouge (Erreur)
-
-
- Séries de bouton :
-
- MB_ABORTRETRYIGNORE Abandonner, Réesayer, Ignorer
- MB_OK OK
- MB_RETRYCANCEL Réesayer, Annuler
- MB_YESNO Oui, Non
- MB_YESNOCANCEL Oui, Non, Annuler
-
-
-
- Valeurs renvoye par les boites de dialogues :
-
- IDABORT Abandonner
- IDCANCEL Annuler
- IDIGNORE Ignorer
- IDNO Non
- IDYES Oui
- IDOK Ok
- IDRETRY Réesayer
-
-
- Suivez l'exemple du menu 6 pour tester ces valeurs, il faut simplement faire attention
- à utiliser les bonnes séries de bouton avec les bonnes valeurs renvoyé par les boites de
- dialogues. Par contre vous pouvez afficher l'icone que vous voulez.*/
-
#include<windows.h> //pour MessageBox et MB_ICON...
#include<stdio.h>
void Menu1(void)
{
MessageBox (NULL, "Information", "Signification", MB_ICONINFORMATION);
}
void Menu2(void)
{
MessageBox (NULL, "Attention", "Signification", MB_ICONEXCLAMATION);
}
void Menu3(void)
{
MessageBox (NULL, "Attention (Utilise une autre dénomination)", "Signification", MB_ICONWARNING);
}
void Menu4(void)
{
MessageBox (NULL, "QUESTION", "Signification", MB_ICONQUESTION);
}
void Menu5(void)
{
MessageBox (NULL, "STOP", "Signification", MB_ICONSTOP);
}
void Menu6(void)
{
int VarBoite = MessageBox (NULL, "Appuyer sur un bouton", "Que faire ?", MB_YESNOCANCEL | MB_ICONQUESTION);
if( VarBoite == IDYES )
{
printf("\nVous avez appuye sur OUI\n");
}
else if ( VarBoite == IDNO )
{
printf("\nVous avez appuye sur NON\n");
}
}
void main(void)
{
int choix;
do
{
printf("\nMenu :\n");
printf("1.INFORMATION\n");
printf("2.EXCLAMATION\n");
printf("3.WARNING (meme icone)\n");
printf("4.QUESTION\n");
printf("5.STOP\n");
printf("6.Fenetre avec boutons de choix\n");
printf("7.Quitter\n\n");
printf("Entrez votre choix : ");
scanf("%d", &choix);
if (choix == 1) Menu1();
else if (choix == 2) Menu2();
else if (choix == 3) Menu3();
else if (choix == 4) Menu4();
else if (choix == 5) Menu5();
else if (choix == 6) Menu6();
}
while (choix !=7);
}
/*Récapitulatif
MessageBox (NULL, "Texte", "En tete", MB_ICON...);
Icones :
MB_ICONEXCLAMATION
ou MB_ICONWARNING Point d'exclamation (Attention)
MB_ICONINFORMATION un I dans un cercle (Information)
MB_ICONQUESTION Point d'interrogation (Question)
MB_ICONSTOP Croix dans un cercke rouge (Erreur)
Séries de bouton :
MB_ABORTRETRYIGNORE Abandonner, Réesayer, Ignorer
MB_OK OK
MB_RETRYCANCEL Réesayer, Annuler
MB_YESNO Oui, Non
MB_YESNOCANCEL Oui, Non, Annuler
Valeurs renvoye par les boites de dialogues :
IDABORT Abandonner
IDCANCEL Annuler
IDIGNORE Ignorer
IDNO Non
IDYES Oui
IDOK Ok
IDRETRY Réesayer
Suivez l'exemple du menu 6 pour tester ces valeurs, il faut simplement faire attention
à utiliser les bonnes séries de bouton avec les bonnes valeurs renvoyé par les boites de
dialogues. Par contre vous pouvez afficher l'icone que vous voulez.*/