
#ifndef _FILE_OPENER_H_
#define _FILE_OPENER_H_

#include <windows.h>
#include <string.h>

/*! Opens a windows openfile dialog
/*! 

    /param savedFilename[256]- character array of size 256 to store path 
of filename
    
	  Opens a windows file dialog and stores the full
	path name in savedFilename.  If the function returns true, then
	the name in the savedFilename can be opened using fopen().
	
*/
bool FileOpenDlg(char savedFilename[256])
{
	char szFileName[256] = "";
    OPENFILENAME ofn;
    ZeroMemory(&ofn, sizeof(ofn));
    ofn.lStructSize = sizeof(ofn);
    ofn.lpstrFile = szFileName;
    ofn.nMaxFile = sizeof(szFileName);
    ofn.lpstrFilter = "FCG\0*.FCG\0All\0*.*\0\0";
    ofn.nFilterIndex = 1;
    ofn.lpstrFileTitle = NULL;
    ofn.nMaxFileTitle = 0;
    ofn.lpstrInitialDir = NULL;
    ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_SHAREAWARE;
 
    if (GetOpenFileName(&ofn))
	{
		strcpy(savedFilename, szFileName);
		return true;
	}
	return false;
}

#endif // _FILE_OPENER_H_

