Hola ecfisa,
el código que estoy utilizando es este:
Código:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void ListFiles(String folder, TStrings *TS)
{
WIN32_FIND_DATA wfd;
HANDLE hFind;
DWORD ERR;
hFind = FindFirstFile(String(folder + "\\*.*").c_str(), &wfd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
if (String(wfd.cFileName) != "." && String(wfd.cFileName) != "..") {
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
ListFiles(String(folder+"\\"+wfd.cFileName), TS);
else
TS->Add(String(folder+"\\"+wfd.cFileName));
}
} while(FindNextFile(hFind, &wfd));
FindClose(&wfd);
}
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ListFiles("E:\\", ListBox1->Items);
}
porseacaso te mando estos datos:
- version trial del Embarcadero c++ XE5.
- windows 7 64 bits.
quizás sea la version en la que se compila y ejecuta.
Saludos.