Skip to main content
gamedev.net
🔒 Locked

File Listing...

Started by GaMe wIg Oct 2, 2002 at 10:03 PM 0 replies 650+ views
Original Post
GaMe wIg
GaMe wIg
How do you list all the files in a directory using C/C++? OR How do you open the standard Windows Open Dialog Box?
elis-cool
elis-cool
To get all the files in a Dir you use the FindFirstFile() and FindNextFile() functions, look them up on msdn, and to open the standard dialog you use the getopenfilename()\getsavefilename() functions... eg heres some source riped striaght out of my current project
  
OPENFILENAME ofn;
char szFile[300] = {''\0''};

ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = App.CWindows.hMain;;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "NewsAgent Project *.prj\0*.prj\0All *.*\0*.*\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = 0;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

if(!GetOpenFileName(&ofn)) break;
[email=esheppard@gmail.com]esheppard@gmail.com[/email]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.