begin process at 2010 03 19 14:24:15
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

API

 > MODIFIER ICONE REPERTOIRE [C][WIN32]

MODIFIER ICONE REPERTOIRE [C][WIN32]


 Information sur la source

Note :
Aucune note
Catégorie :API Niveau :Débutant Date de création :31/08/2004 Vu / téléchargé :5 472 / 164

Auteur : AlexMAN

Ecrire un message privé
Commentaire sur cette source (2)
Ajouter un commentaire et/ou une note

 Description

Bonjour,

Ce code liste toutes les icones des fichiers *.exe et *.dll présents dans un répertoire, les affiche a l'aide d'une ListView et applique l'icone désirée au répertoire parent.

Source

  • #include <windows.h>
  • #include <shlobj.h>
  • #include <commctrl.h>
  • #include "resource.h"
  • #pragma comment(lib, "comctl32.lib")
  • #define WM_ENDTHR WM_USER + 1
  • #define SZCLASSDESKTOP "[.ShellClassInfo]\r\nIconFile="
  • #define SZICONINDEX "\r\nIconIndex="
  • HWND hDlg, hlist, hpb;
  • HANDLE hthread;
  • DWORD dwthread;
  • char szpath[260];
  • char szwrite[512];
  • char *szptr;
  • //Fonction BruNews
  • __declspec (naked) char* __stdcall bnultoa(unsigned int dwnum, char* szdst)
  • {
  • __asm {
  • mov eax, [esp+4]
  • mov ecx, [esp+8]
  • or eax, eax
  • jnz short L1
  • lea eax, [ecx+1]
  • mov byte ptr[ecx], 48
  • mov byte ptr[eax], 0
  • ret 8
  • L1:
  • mov [esp-4], edi
  • mov [esp-8], ecx
  • mov edi, ecx
  • mov ecx, eax
  • L2:
  • mov eax, -858993459
  • mul ecx
  • mov eax, edx
  • shr eax, 3
  • mov edx, ecx
  • lea ecx, [eax+eax*8]
  • add ecx, eax
  • sub edx, ecx
  • add dl, 48
  • mov [edi], dl
  • mov ecx, eax
  • inc edi
  • test eax, eax
  • jnz short L2
  • mov [esp-12], edi
  • mov eax, [esp-8]
  • mov byte ptr[edi], 0
  • L3:
  • dec edi
  • mov dl, [eax]
  • mov cl, [edi]
  • mov [edi], dl
  • mov [eax], cl
  • inc eax
  • cmp eax, edi
  • jb short L3
  • mov edi, [esp-4]
  • mov eax, [esp-12]
  • ret 8
  • }
  • }
  • __inline char* bnstrcpy(char *dst, char *src) // return ptr sur NULL final
  • {
  • __asm {
  • mov eax, dst
  • mov ecx, src
  • dec eax
  • LcpyLoop:
  • mov dl, [ecx]
  • inc eax
  • inc ecx
  • mov [eax], dl
  • or dl, dl
  • jz short LcpyOut
  • mov dl, [ecx]
  • inc eax
  • inc ecx
  • mov [eax], dl
  • or dl, dl
  • jz short LcpyOut
  • mov dl, [ecx]
  • inc eax
  • inc ecx
  • mov [eax], dl
  • or dl, dl
  • jnz short LcpyLoop
  • LcpyOut:
  • }
  • }
  • DWORD __stdcall ThreadProc(LPVOID lp)
  • {
  • WIN32_FIND_DATA wfd;
  • LV_ITEM lvi;
  • HIMAGELIST himglist;
  • HICON *hbig;
  • HANDLE hrep, hheap = GetProcessHeap();
  • DWORD dwnumbericon = 0, i, dwdeb, dwtot = 0;
  • char *c, *s, buf[128];
  • strcpy(szptr, "\\*.*"); s = ++szptr; //on sauve s pour la suite du prog.
  • hrep = FindFirstFile(szpath, &wfd);
  • if (INVALID_HANDLE_VALUE == hrep) return 0;
  • dwdeb = GetTickCount();
  • SendMessage(hlist, LVM_DELETEALLITEMS, 0, 0);
  • lvi.mask = LVIF_TEXT | LVIF_IMAGE;
  • lvi.iSubItem = 0;
  • himglist = ImageList_Create(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), ILC_COLORDDB | ILC_MASK, dwnumbericon, 1);
  • SendMessage(hlist, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himglist);
  • while (FindNextFile(hrep, &wfd)) {
  • if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //si c'est un repertoire, on ignore
  • SetDlgItemText(hDlg, IDST_FILE, wfd.cFileName);
  • c = wfd.cFileName; while (*c && *c++ != '.');
  • if (strcmp(c, "exe") && strcmp(c, "dll")) continue; //si c'est pas un exe ou dll, on ignore
  • strcpy(s, wfd.cFileName);
  • dwnumbericon = ExtractIconEx(szpath, -1, 0, 0, 0);
  • if (!dwnumbericon) continue; //si pas d'icones, on ignore
  • SendMessage(hpb, PBM_SETPOS, 0, 0);
  • SendMessage(hpb, PBM_SETRANGE, 0, MAKELPARAM(0, dwnumbericon));
  • hbig = (HICON *) HeapAlloc(hheap, 0, dwnumbericon * 4);
  • ExtractIconEx(szpath, 0, hbig, 0, dwnumbericon);
  • c += 3; *c++ = ' ';
  • lvi.pszText = wfd.cFileName;
  • for (i = 0; i < dwnumbericon; ++i) {
  • lvi.iImage = ImageList_AddIcon(himglist, hbig[i]);
  • lvi.iItem = i;
  • strcpy(c, itoa(i, buf, 10)); //ajoute l'index de l'icone a la suite du texte
  • SendMessage(hlist, LVM_INSERTITEM, 0, (LPARAM)&lvi);
  • SendMessage(hpb, PBM_STEPIT, 0, 0);
  • }
  • dwtot += i;
  • HeapFree(hheap, 0, hbig);
  • }
  • dwdeb = (GetTickCount() - dwdeb); //avoir le temps en secondes
  • *((DWORD *)buf) = 0x706D6F43; // "Comp"
  • *((DWORD *)(buf + 4)) = 0x2074656C; //"let "
  • c = bnultoa(dwdeb, (buf + 8));
  • *((DWORD *)c) = 0x2D20736D; //"ms -"
  • c = bnultoa(dwtot, (c + 4));
  • *((DWORD *)c) = 0x6F636920; //" ico"
  • *((DWORD *)(c + 4)) = 0x0073656E; //"nes "
  • SetDlgItemText(hDlg, IDST_FILE, buf);
  • DeleteObject(himglist);
  • FindClose(hrep);
  • PostMessage(hDlg, WM_ENDTHR, 0, 0);
  • return 1;
  • }
  • void ApplicIcone(int iItem)
  • {
  • LVITEM lvi;
  • LRESULT lresult;
  • HANDLE hfile;
  • DWORD dwWritten = 0;
  • char buf[300], *b = buf, *c;
  • lvi.cchTextMax = 300;
  • lvi.pszText = buf;
  • lvi.iSubItem = 0;
  • lresult = SendMessage(hlist, LVM_GETITEMTEXT, iItem, (LPARAM)&lvi);
  • if (!lresult) return;
  • SetFileAttributes(szpath, FILE_ATTRIBUTE_SYSTEM);
  • strcpy(szptr, "desktop.ini");
  • hfile = CreateFile(szpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN, 0);
  • if (INVALID_HANDLE_VALUE == hfile) return;
  • while (*b) b++;
  • while (*b != ' ') b--;
  • *b = 0; b++;
  • c = bnstrcpy(szwrite, SZCLASSDESKTOP);
  • c = bnstrcpy(c, buf);
  • c = bnstrcpy(c, SZICONINDEX);
  • bnstrcpy(c, b);
  • WriteFile(hfile, szwrite, strlen(szwrite), &dwWritten, 0);
  • MessageBox(0, "Fichier créé, icone appliquée.", "OK", 0);
  • CloseHandle(hfile);
  • }
  • int ObtDirectory()
  • {
  • BROWSEINFO bi;
  • ITEMIDLIST *il;
  • char buff[300];
  • bi.hwndOwner = hDlg;
  • bi.pidlRoot = NULL;
  • bi.pszDisplayName = buff;
  • bi.lpszTitle = "Choisissez un répertoire :";
  • bi.ulFlags = 0;
  • bi.lpfn = NULL;
  • if (NULL == (il = SHBrowseForFolder(&bi))) return 0;
  • return SHGetPathFromIDList(il, szpath);
  • }
  • BOOL CALLBACK DlgProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
  • {
  • static int iItem = -1;
  • switch (message) {
  • case WM_INITDIALOG:
  • SetClassLong(hwnd, GCL_HICON, (long)LoadIcon(0, IDI_APPLICATION));
  • hDlg = hwnd;
  • hlist = GetDlgItem(hwnd, IDLV_ICON);
  • hpb = GetDlgItem(hwnd, IDPB_ICON);
  • SendMessage(hpb, PBM_SETSTEP, 1, 0);
  • return 1;
  • case WM_ENDTHR:
  • CloseHandle(hthread);
  • dwthread = 0;
  • return 0;
  • case WM_COMMAND:
  • switch (wparam) {
  • case IDOK:
  • if (!szpath[0]) { MessageBox(hwnd, "Choisissez un répertoire.", 0, 0x40); return 0; }
  • hthread = CreateThread(0, 0, ThreadProc, 0, 0, &dwthread);
  • return 0;
  • case IDCANCEL:
  • if (dwthread) {
  • TerminateThread(hthread, 0);
  • CloseHandle(hthread);
  • }
  • EndDialog(hwnd, 0);
  • return 0;
  • case IDBT_STOP:
  • if (dwthread) {
  • SuspendThread(hthread);
  • if (IDNO == MessageBox(hwnd, "Etes-vous sur de vouloir stopper la recherche ?", "Fin prématurée", MB_YESNO)) {
  • ResumeThread(hthread);
  • return 0;
  • }
  • TerminateThread(hthread, 0);
  • }
  • return 0;
  • case IDBT_APPLIC:
  • if (iItem == -1) { MessageBox(hwnd, "Sélectionnez un item", 0, 0x40); return 0; }
  • ApplicIcone(iItem);
  • return 0;
  • case IDBT_FIND:
  • SetDlgItemText(hwnd, IDST_FILE, 0);
  • SendMessage(hpb, PBM_SETPOS, 0, 0);
  • if (!ObtDirectory()) { iItem = -1; *szpath = 0; }
  • else { szptr = szpath; while (*szptr) szptr++; }
  • SendMessage(hlist, LVM_DELETEALLITEMS, 0, 0);
  • SetDlgItemText(hwnd, IDEC_PATH, szpath);
  • return 0;
  • }
  • case WM_NOTIFY:
  • if (wparam == IDLV_ICON)
  • if (((LPNMITEMACTIVATE)lparam)->hdr.code == NM_CLICK)
  • iItem = ((LPNMITEMACTIVATE)lparam)->iItem;
  • default:
  • return 0;
  • }
  • }
  • int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE p, LPSTR q, int r)
  • {
  • InitCommonControls();
  • DialogBoxParam(hInstance, (LPCTSTR)IDD_ICON, 0, DlgProc, 0);
  • return 0;
  • }
#include <windows.h>
#include <shlobj.h>
#include <commctrl.h>
#include "resource.h"

#pragma comment(lib, "comctl32.lib")

#define WM_ENDTHR WM_USER + 1
#define SZCLASSDESKTOP "[.ShellClassInfo]\r\nIconFile="
#define SZICONINDEX "\r\nIconIndex="

HWND hDlg, hlist, hpb;
HANDLE hthread;
DWORD dwthread;
char szpath[260];
char szwrite[512];
char *szptr;

//Fonction BruNews
__declspec (naked) char* __stdcall bnultoa(unsigned int dwnum, char* szdst)
{
  __asm {
    mov      eax, [esp+4]
    mov      ecx, [esp+8]
    or       eax, eax
    jnz      short L1
    lea      eax, [ecx+1]
    mov      byte ptr[ecx], 48
    mov      byte ptr[eax], 0
    ret      8
 L1:
    mov      [esp-4], edi
    mov      [esp-8], ecx
    mov      edi, ecx
    mov      ecx, eax
 L2:
    mov      eax, -858993459
    mul      ecx
    mov      eax, edx
    shr      eax, 3
    mov      edx, ecx
    lea      ecx, [eax+eax*8]
    add      ecx, eax
    sub      edx, ecx
    add      dl, 48
    mov      [edi], dl
    mov      ecx, eax
    inc      edi
    test     eax, eax
    jnz      short L2
    mov      [esp-12], edi
    mov      eax, [esp-8]
    mov      byte ptr[edi], 0
 L3:
    dec      edi
    mov      dl, [eax]
    mov      cl, [edi]
    mov      [edi], dl
    mov      [eax], cl
    inc      eax
    cmp      eax, edi
    jb       short L3
    mov      edi, [esp-4]
    mov      eax, [esp-12]
    ret      8
  }
}

__inline char* bnstrcpy(char *dst, char *src) // return ptr sur NULL final
{
  __asm {
    mov   eax, dst
    mov   ecx, src
    dec   eax
LcpyLoop:
    mov   dl, [ecx]
    inc   eax
    inc   ecx
    mov   [eax], dl
    or    dl, dl
    jz    short LcpyOut
    mov   dl, [ecx]
    inc   eax
    inc   ecx
    mov   [eax], dl
    or    dl, dl
    jz    short LcpyOut
    mov   dl, [ecx]
    inc   eax
    inc   ecx
    mov   [eax], dl
    or    dl, dl
    jnz   short LcpyLoop
LcpyOut:
  }
}

DWORD __stdcall ThreadProc(LPVOID lp)
{
	WIN32_FIND_DATA wfd;
	LV_ITEM lvi;
	HIMAGELIST himglist;
	HICON *hbig;
	HANDLE hrep, hheap = GetProcessHeap();
	DWORD dwnumbericon = 0, i, dwdeb, dwtot = 0;
	char *c, *s, buf[128];
	
	strcpy(szptr, "\\*.*"); s = ++szptr; //on sauve s pour la suite du prog.
	hrep = FindFirstFile(szpath, &wfd);
	if (INVALID_HANDLE_VALUE == hrep) return 0;
	dwdeb = GetTickCount();
	SendMessage(hlist, LVM_DELETEALLITEMS, 0, 0);
	lvi.mask = LVIF_TEXT | LVIF_IMAGE;
	lvi.iSubItem = 0;
	himglist = ImageList_Create(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), ILC_COLORDDB | ILC_MASK, dwnumbericon, 1);
	SendMessage(hlist, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himglist);
	while (FindNextFile(hrep, &wfd)) {
		if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;	//si c'est un repertoire, on ignore
		SetDlgItemText(hDlg, IDST_FILE, wfd.cFileName);
		c = wfd.cFileName; while (*c && *c++ != '.');
		if (strcmp(c, "exe") && strcmp(c, "dll")) continue;		//si c'est pas un exe ou dll, on ignore
		strcpy(s, wfd.cFileName);
		dwnumbericon = ExtractIconEx(szpath, -1, 0, 0, 0);
		if (!dwnumbericon) continue;		//si pas d'icones, on ignore
		SendMessage(hpb, PBM_SETPOS, 0, 0);
		SendMessage(hpb, PBM_SETRANGE, 0, MAKELPARAM(0, dwnumbericon));
		hbig = (HICON *) HeapAlloc(hheap, 0, dwnumbericon * 4);
		ExtractIconEx(szpath, 0, hbig, 0, dwnumbericon);
		c += 3;	*c++ = ' ';					
		lvi.pszText = wfd.cFileName;
		for (i = 0; i < dwnumbericon; ++i) {
            lvi.iImage = ImageList_AddIcon(himglist, hbig[i]);
			lvi.iItem = i;
			strcpy(c, itoa(i, buf, 10));		//ajoute l'index de l'icone a la suite du texte
			SendMessage(hlist, LVM_INSERTITEM, 0, (LPARAM)&lvi);
			SendMessage(hpb, PBM_STEPIT, 0, 0);
		}
		dwtot += i;
        HeapFree(hheap, 0, hbig);
	}
	
	dwdeb = (GetTickCount() - dwdeb);	//avoir le temps en secondes
	*((DWORD *)buf) = 0x706D6F43; // "Comp"
	*((DWORD *)(buf + 4)) = 0x2074656C; //"let "
	c = bnultoa(dwdeb, (buf + 8));
	*((DWORD *)c) = 0x2D20736D; //"ms -"
	c = bnultoa(dwtot, (c + 4));
	*((DWORD *)c) = 0x6F636920; //" ico"
	*((DWORD *)(c + 4)) = 0x0073656E; //"nes "
	SetDlgItemText(hDlg, IDST_FILE, buf);
	DeleteObject(himglist);
	FindClose(hrep);
	PostMessage(hDlg, WM_ENDTHR, 0, 0);
	return 1;
}

void ApplicIcone(int iItem) 
{
	LVITEM lvi;
	LRESULT lresult;
	HANDLE hfile;
	DWORD dwWritten = 0;
	char buf[300], *b = buf, *c;
	
	lvi.cchTextMax = 300;
	lvi.pszText = buf;
	lvi.iSubItem = 0;
	lresult = SendMessage(hlist, LVM_GETITEMTEXT, iItem, (LPARAM)&lvi);
	if (!lresult) return;
	SetFileAttributes(szpath, FILE_ATTRIBUTE_SYSTEM);
	strcpy(szptr, "desktop.ini");
	hfile = CreateFile(szpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN, 0);
	if (INVALID_HANDLE_VALUE == hfile) return;
	while (*b) b++;
	while (*b != ' ') b--;
	*b = 0; b++;
    c = bnstrcpy(szwrite, SZCLASSDESKTOP);
	c = bnstrcpy(c, buf);
	c = bnstrcpy(c, SZICONINDEX);
	bnstrcpy(c, b);
	WriteFile(hfile, szwrite, strlen(szwrite), &dwWritten, 0);
    MessageBox(0, "Fichier créé, icone appliquée.", "OK", 0);
	CloseHandle(hfile);
}

int ObtDirectory() 
{
    BROWSEINFO bi;
    ITEMIDLIST *il;
    char buff[300];

    bi.hwndOwner = hDlg;
    bi.pidlRoot  = NULL;
    bi.pszDisplayName = buff;
    bi.lpszTitle = "Choisissez un répertoire :";
    bi.ulFlags   = 0;
    bi.lpfn      = NULL;
    if (NULL == (il = SHBrowseForFolder(&bi))) return 0;
    
	return SHGetPathFromIDList(il, szpath);
}

BOOL CALLBACK DlgProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
	static int iItem = -1;

	switch (message) {
		case WM_INITDIALOG:
			SetClassLong(hwnd, GCL_HICON, (long)LoadIcon(0, IDI_APPLICATION));
			hDlg = hwnd;
			hlist = GetDlgItem(hwnd, IDLV_ICON);
			hpb = GetDlgItem(hwnd, IDPB_ICON);
			SendMessage(hpb, PBM_SETSTEP, 1, 0);
			return 1;
		case WM_ENDTHR:
			CloseHandle(hthread); 
			dwthread = 0;
			return 0;
		case WM_COMMAND:
			switch (wparam) {
				case IDOK:
					if (!szpath[0]) { MessageBox(hwnd, "Choisissez un répertoire.", 0, 0x40); return 0; }
					hthread = CreateThread(0, 0, ThreadProc, 0, 0, &dwthread);
					return 0;
				case IDCANCEL:
					if (dwthread) {
                        TerminateThread(hthread, 0);
						CloseHandle(hthread);
					}
					EndDialog(hwnd, 0);
					return 0;
				case IDBT_STOP:
					if (dwthread) {
						SuspendThread(hthread);
						if (IDNO == MessageBox(hwnd, "Etes-vous sur de vouloir stopper la recherche ?", "Fin prématurée", MB_YESNO)) {
							ResumeThread(hthread);
							return 0;
						}
						TerminateThread(hthread, 0);
					}
					return 0;
				case IDBT_APPLIC:
					if (iItem == -1) { MessageBox(hwnd, "Sélectionnez un item", 0, 0x40); return 0; }
					ApplicIcone(iItem);
                    return 0;					
				case IDBT_FIND:
					SetDlgItemText(hwnd, IDST_FILE, 0);
					SendMessage(hpb, PBM_SETPOS, 0, 0);
					if (!ObtDirectory()) { iItem = -1; *szpath = 0; }
					else { szptr = szpath; while (*szptr) szptr++; }
					SendMessage(hlist, LVM_DELETEALLITEMS, 0, 0);
					SetDlgItemText(hwnd, IDEC_PATH, szpath);
					return 0;
			}
		case WM_NOTIFY:
			if (wparam == IDLV_ICON)
				if (((LPNMITEMACTIVATE)lparam)->hdr.code == NM_CLICK)
					iItem = ((LPNMITEMACTIVATE)lparam)->iItem;
		default:
			return 0;
	}
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE p, LPSTR q, int r)
{
	InitCommonControls();
	DialogBoxParam(hInstance, (LPCTSTR)IDD_ICON, 0, DlgProc, 0);

	return 0;
}

 Conclusion

Voila, je remercie Arnotic pour sa relecture du code et des changements qu'il y a apporté.

 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 LISTVIEW PATHFINDING (WIN32)
Source avec Zip Source avec une capture PANNEAU LUMINEUX (WIN32)
Source avec Zip NOMBRE NARCISSIQUE (WIN32, ASM)
Source avec Zip Source avec une capture VERSION WINDOWS
Source avec Zip Source avec une capture ALERTE FILM[WIN32][VC.NET]

 Sources de la même categorie

Source avec Zip Source avec une capture CALENDRIER (WIN64) par BruNews
Source avec Zip Source avec une capture IMPRESSION EN WIN32 API AVEC OPTIONS par racpp
Source avec Zip Source avec une capture INFOTIP SHELL EXTENSION (BULLE DE L'EXPLORATEUR WINDOWS) (WI... par racpp
Source avec Zip Source avec une capture BROUILLAGE DES FICHIERS JAVASCRIPT ET CSS(WIN32) par gagah1
Source avec Zip Source avec une capture CHANGE CURSEUR par ganjarasta

Commentaires et avis

Commentaire de cleter le 28/05/2005 15:54:33

Slt,
Je recherche à lister les exe qui se trouvent dans un repertoire et je suis tombé sur ta source. En essayant l'exécutable j'ai vu quelle fesait une partie de ce que je recherche, mais en voulant lire le code....Je trouve qu'il manque cruellement de commantaire. Et que même le nom des fonctions ne semble pas très parlant "bnstrcpy" je comprend juste que ca copie quelque chose mais apres....
Et puis vu que tu nous as mis de l'assembleur au milieu....
Que tu maitrise l'asm et le c/cpp c'est bien, mais si personne ne comprend ce que tu fais...c'est moins bien.

Commentaire de AlexMAN le 28/05/2005 18:42:19

Je suis (malheureusement) loin de maitriser asm et C, mais il est vrai que ce code n'est pas génial et que pour comprendre quelque chose, il faut l'avoir ecrit...
Je te passe un code pour te permettre de faire ce que tu veux :

hrep = FindFirstFile(szpath, &wfd);
    if (INVALID_HANDLE_VALUE == hrep) return 0;

    while (FindNextFile(hrep, &wfd)) {
        if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;    //si c'est un repertoire, on ignore
        c = wfd.cFileName; while (*c && *c++ != '.');
        if (strcmp(c, "exe")) continue;        //si c'est pas un exe, on ignore
        strcpy(s, wfd.cFileName);
        //Maintenant tu recuperes tous les exe.
    }


Bon j'ai pas testé, mais a vue de nez, ca devrait marcher, et pis tu as de quoi comprendre je pense.
Ensuite, si tu veux lister les exe d'un seul repertoire, c'est bon, sinon, va falloir faire une ptite fonction recursive pour rentrer dans chacun des repertoires trouvés.

Voila, si tu veux encore des renseignements, n'hesite pas.

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

Photothèque

 
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,562 sec (3)

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