1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| //---------------------------------------------------------------------------
//
// FUNCTION: Initialisation_Ressources(HWND hWnd = NULL)
//
// PURPOSE: Initilisation du fichier hoste pour l'application
//
// COMMENTS:
// Sauvegarde le fichier hoste si il n'existe pas et ajoute les IP des imprimantes
//
//
//
//---------------------------------------------------------------------------
BOOL Decompression_ZipFile(HWND hWnd)
{
string strTempPath, strFichierZip, strFichier;
char cTemp[MAX_PATH];
OFSTRUCT OpenStructure;
INT hSource, hDestination;
LONG Result;
//Récupération du chemin du répertoire temporaire
GetTempPath(MAX_PATH, cTemp);
strTempPath.assign(cTemp);
strFichier = strTempPath;
strFichier += "Flash\\";
CreateDirectory(strFichier.c_str(), NULL);
//Boucle de décompression des fichiers contennu dans le zip
//Ouverture du fichier dans le zip
strFichier = strTempPath;
strFichier += "Temp.zip\\IP Imprimantes.txt";
hSource = LZOpenFile( (LPSTR) strFichier.c_str(), &OpenStructure, OF_PROMPT);
Error_Msg(GetLastError(), "LZOpenFile() / Temp.zip\\IP Imprimantes.txt", __FILE__, __LINE__);
//Création du fichier de destiantion
strFichier = strTempPath;
strFichier += "Flash\\IP Imprimantes.txt";
hDestination = LZOpenFile( (LPSTR) strFichier.c_str(), &OpenStructure, OF_CREATE);
Error_Msg(GetLastError(), "LZOpenFile() / Flash\\IP Imprimantes.txt", __FILE__, __LINE__);
Result = LZCopy(hSource, hDestination);
Error_Msg(GetLastError(), "LZCopy() / IP Imprimantes.txt", __FILE__, __LINE__);
LZClose(hSource);
LZClose(hDestination);
return TRUE;
} |
Partager