begin process at 2012 05 27 15:42:27
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Fichiers / Disque

 > Y A T'IL UNE DISQUETTE DANS LE LECTEUR ? (WIN32).

Y A T'IL UNE DISQUETTE DANS LE LECTEUR ? (WIN32).


 Information sur la source

Note :
Aucune note
Catégorie :Fichiers / Disque Niveau :Débutant Date de création :15/07/2004 Vu / téléchargé :2 464 / 121

Auteur : magma

Ecrire un message privé
Ce membre participe au partage de revenus publicitaires
Commentaire sur cette source (3)
Ajouter un commentaire et/ou une note


 Description

Cliquez pour voir la capture en taille normale

Cette source montre, entre autres, l'utilisation des fonctions:
- SetErrorMode(...)
- MessageBoxIndirect(...)


Source

  • //---------------------------------------------------------------------
  • // isDiskInDrive.c
  • //---------------------------------------------------------------------
  • #include <windows.h>
  • //---------------------------------------------------------------------
  • BOOL isDiskInDrive(void)
  • {
  • WIN32_FIND_DATA ffd = {0};
  • UINT pem = SetErrorMode(SEM_FAILCRITICALERRORS);
  • HANDLE hff = FindFirstFile( "A:\\*.*", &ffd );
  • BOOL bok = GetLastError() != ERROR_NOT_READY;
  • if(hff != INVALID_HANDLE_VALUE) FindClose(hff);
  • SetErrorMode(pem);
  • return bok;
  • }
  • //--------------------------------------------------------------------
  • int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hpinst, LPSTR p, int n )
  • {
  • int reponse;
  • MSGBOXPARAMS mbp = {sizeof(MSGBOXPARAMS)};
  • mbp.hInstance = LoadLibrary("Shell32");
  • mbp.lpszCaption = "isDiskInDrive";
  • mbp.dwStyle = MB_RETRYCANCEL | MB_DEFBUTTON1 | MB_USERICON;
  • do
  • {
  • if(isDiskInDrive())
  • {
  • mbp.lpszIcon = MAKEINTRESOURCE(8);
  • mbp.lpszText = "Il y a une disquette dans le lecteur A: ";
  • reponse = MessageBoxIndirect(&mbp);
  • }
  • else
  • {
  • mbp.lpszIcon = MAKEINTRESOURCE(7);
  • mbp.lpszText = "Il n'y a pas de disquette dans le lecteur A: ";
  • reponse = MessageBoxIndirect(&mbp);
  • }
  • }while(reponse == IDRETRY);
  • FreeLibrary(mbp.hInstance);
  • return 0;
  • }
//---------------------------------------------------------------------
// isDiskInDrive.c
//---------------------------------------------------------------------

#include <windows.h>


//---------------------------------------------------------------------
BOOL isDiskInDrive(void)
{
  WIN32_FIND_DATA ffd = {0};
  UINT            pem = SetErrorMode(SEM_FAILCRITICALERRORS);
  HANDLE          hff = FindFirstFile( "A:\\*.*", &ffd );
  BOOL            bok = GetLastError() != ERROR_NOT_READY;

  if(hff != INVALID_HANDLE_VALUE) FindClose(hff);
  SetErrorMode(pem);
  return bok;
}


//--------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hpinst, LPSTR p, int n )
{
  int reponse;
  MSGBOXPARAMS mbp = {sizeof(MSGBOXPARAMS)};

  mbp.hInstance   = LoadLibrary("Shell32");
  mbp.lpszCaption = "isDiskInDrive";
  mbp.dwStyle     = MB_RETRYCANCEL | MB_DEFBUTTON1 | MB_USERICON;

  do 
  {
    if(isDiskInDrive()) 
    {
      mbp.lpszIcon = MAKEINTRESOURCE(8);        
      mbp.lpszText = "Il y a une disquette dans le lecteur A: ";        
      reponse      = MessageBoxIndirect(&mbp);    

    }
    else
    {
      mbp.lpszIcon = MAKEINTRESOURCE(7);           
      mbp.lpszText = "Il n'y a pas de disquette dans le lecteur A: ";        
      reponse      = MessageBoxIndirect(&mbp);
    }        
  }while(reponse == IDRETRY);

  FreeLibrary(mbp.hInstance);
  return 0;
}


 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

Source avec Zip Source avec une capture WINDOG LE CHIEN
Source avec Zip TRANCE MUSIC
Source avec Zip YOUPI LE PINGOUIN
Source avec Zip Source avec une capture OBSERVATIONS METEO VIA INTERNET (WIN32)
Source avec Zip Source avec une capture SHUTDOWN DOWNTIME BOOT UPTIME

 Sources de la même categorie

COMPTER LE NOMBRE DE PAGES D'UN FICHIER PDF par Renfield
Source avec Zip Source avec une capture GENERE BMP par lajouad
Source avec Zip Source avec une capture GETIONNAIRE D'UNE BIBLIOTHÉQUE EN C par benzarabel
FONCTION D'ÉDITION DE FICHIER BIT À BIT [C-MULTIPLATEFORME] par lynxtyle
Source avec Zip Source avec une capture UN GESTIONNAIRE DU FICHIER par benzarabel

Commentaires et avis

Commentaire de neo_00110010101 le 16/07/2004 14:18:04

rien à dire, ça marche :]

Commentaire de BruNews le 16/07/2004 14:41:06 administrateur CS

Un simple retour de GetVolumeInformation() aussi.

Commentaire de informatique02 le 27/05/2008 00:06:46

votre programme te super je te félécite 10/10
mais comment le modifier pr qu'il marche sur linux?

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,608 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales