Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvoid Associer () { HKEY hKey; LONG ret; char cle1[]=".moi";//clé d'extension char cle2[]="moifile";//clé principale char description[]="Fichier moi";//description dans l'explorateur char CheminExe[]=""C:\\notepad.exe" "%1"";//chemin de l'appli ret=RegCreateKeyEx(HKEY_CLASSES_ROOT,cle1,0,0,0,KEY_ALL_ACCESS,0,&hKey,0); ret=RegSetValueEx(hKey,0,0,REG_SZ,(PBYTE)cle2,strlen(cle2)+1); RegCloseKey(hKey); ret=RegCreateKeyEx(HKEY_CLASSES_ROOT,cle2,0,0,0,KEY_ALL_ACCESS,0,&hKey, 0); ret=RegSetValueEx(hKey,0,0,REG_SZ,(PBYTE)description,strlen(description)+1); RegCloseKey(hKey); char souscle[50]; strcpy(souscle,cle2); strcat(souscle,"\\shell\\open\\command"); ret=RegCreateKeyEx(HKEY_CLASSES_ROOT,souscle,0,0,0,KEY_ALL_ACCESS,0,&hKey,0); ret=RegSetValueEx(hKey,0,0,REG_SZ,(PBYTE)CheminExe,strlen(CheminExe)+1); RegCloseKey(hKey); }
strcpy(souscle,cle2); strcat(souscle,"\\DefaultIcon");