Using ListBox to view directory files - Visual C ++

0

I am new using Visual C ++, and I need to know how to view the files in a directory using ListBox in Visual c ++. I hope you can help me, thank you in advance.

    
asked by Misael Lopez 03.11.2016 в 04:26
source

1 answer

0

Send the message LB_DIR when you create the ListBox:

HWND lbHWnd;    // Este es el handle que se obtuvo al crear el ListBox con CreateWindowEx

SendMessage(lbHWnd, LB_DIR, DDL_READWRITE | DDL_READONLY | DDL_HIDDEN
            | DDL_SYSTEM | DDL_DIRECTORY | DDL_ARCHIVE | DDL_DRIVES, (LPARAM)TEXT("*.*"));

DDL_ flags specify which files will be filtered in the ListBox.

The files that will be displayed in the ListBox are those corresponding to the directory in which the program is executed .. to specify another function call:

SetCurrentDirectory(LPCSTR directorio_a_examinar);

I hope it helps ...

    
answered by 28.11.2016 в 04:54