/* * ------------------------------------------ * File Box Functions * ------------------------------------------ */ #include #include static OPENFILENAME ofn; void FileInitialize(void) { static TCHAR szFilter[] = "Coastlines, Islands And Lakes (CIL.CBD)\0cil.cbd\0" \ "Rivers (RIV.CBD)\0riv.cbd\0" \ "Int. Political Boundaries (BDY.CBD)\0bdy.cbd\0" \ "Nat. Political Boundaries (PBY.CBD)\0pby.cbd\0" \ "All Files (*.*)\0*.*\0\0"; ofn.lStructSize = sizeof (OPENFILENAME); ofn.hwndOwner = NULL; ofn.hInstance = NULL; ofn.lpstrFilter = szFilter; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = NULL; // Set in Open and Close functions ofn.nMaxFile = MAX_PATH; ofn.lpstrFileTitle = NULL; // Set in Open and Close functions ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = NULL; ofn.Flags = 0; // Set in Open and Close functions ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "cil"; ofn.lCustData = 0L; ofn.lpfnHook = NULL; ofn.lpTemplateName = NULL; } void DirInitialize(void) { static TCHAR szFilter[] = "All Files (*.*)\0*.*\0\0"; ofn.lStructSize = sizeof (OPENFILENAME); ofn.hwndOwner = NULL; ofn.hInstance = NULL; ofn.lpstrFilter = szFilter; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = NULL; // Set in Open and Close functions ofn.nMaxFile = MAX_PATH; ofn.lpstrFileTitle = NULL; // Set in Open and Close functions ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = NULL; ofn.Flags = 0; // Set in Open and Close functions ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "cil"; ofn.lCustData = 0L; ofn.lpfnHook = NULL; ofn.lpTemplateName = NULL; } BOOL FileOpenDlg(HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) { ofn.hwndOwner = hwnd; ofn.lpstrFile = pstrFileName; ofn.lpstrFileTitle = pstrTitleName; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; return GetOpenFileName (&ofn); } BOOL FileSaveDlg(HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) { ofn.hwndOwner = hwnd; ofn.lpstrFile = pstrFileName; ofn.lpstrFileTitle = pstrTitleName; ofn.Flags = OFN_OVERWRITEPROMPT; return GetSaveFileName (&ofn); } BOOL DirOpenDlg(HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitle) { ofn.hwndOwner = hwnd; ofn.lpstrFile = pstrFileName; ofn.lpstrTitle = pstrTitle; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; return GetOpenFileName (&ofn); } .