Take a look at an example program I threw together.
code:// TestFindFirstFile.cpp : Defines the entry point for the application.//#include "stdafx.h"int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ WIN32_FIND_DATA fdFindData; BOOL bKeepGoing = TRUE; HANDLE hFF = ::FindFirstFile("C:\\*", &fdFindData); ::OutputDebugString(fdFindData.cFileName); ::OutputDebugString("\n"); while (::FindNextFile(hFF, &fdFindData)) { ::OutputDebugString(fdFindData.cFileName); ::OutputDebugString("\n"); } return 0;}
This will output every file in C:\ to the Debug window (didn't feel like getting fancy). This also returns directories. If you want to not include directories, look at the dwFileAttributes member of the WIN32_FIND_DATA structure you use.
On a side note, if you are allowing the user to pick a file or something, you might consider using the common dialogs. That might not be appropriate in your situation though...
Let me know if you need any more help via email on this.
------------------
-Kentamanos