1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
//première méthode
if(CopyFile(L"ressources\\cap.exe",sPathAppData.c_str(),FALSE)){
if(TEST){wcout<<"copy1Cap: true"<<endl;}
}else{
if(TEST){wcout<<"copy1Cap: false"<<endl;}
}
//deuxième méthode
SHFILEOPSTRUCT shfosPac;
//pour ne pas afficher de boîtes de dialogue
shfosPac.wFunc=FO_COPY;
//Le fichier à copier
shfosPac.pFrom=L"ressources\\cap.exe\0\0";
//la destination
shfosPac.pTo=sPathAppData.c_str();
shfosPac.fFlags=FOF_SILENT | FOF_NOCONFIRMATION;
//copie des fichiers dans le répertoire
if(SHFileOperation(&shfosPac)){
// SHFileOperation renvoie 0 en cas de succès!!!!
if(TEST){wcout<<"copy2Cap: false"<<endl;}
}else{
if(TEST){cout<<"copy2Cap: true"<<endl;}
} |
Partager