@@ -43,50 +43,31 @@ static void GetDataPath(wchar_t *path, int maxLen) {
4343**============================================================================*/
4444
4545void DoFileNew (void ) {
46- CE_OPENFILENAME ofn ;
4746 wchar_t szFile [MAX_PATH ];
4847 wchar_t szDataPath [MAX_PATH ];
4948
5049 /* Get data path (storage card or My Documents) */
5150 GetDataPath (szDataPath , MAX_PATH );
5251 lstrcpyW (szFile , L"new.db" );
5352
54- memset (& ofn , 0 , sizeof (ofn ));
55- ofn .lStructSize = sizeof (ofn );
56- ofn .hwndOwner = g_hwndMain ;
57- ofn .lpstrFile = szFile ;
58- ofn .nMaxFile = MAX_PATH ;
59- ofn .lpstrFilter = L"Database Files (*.db)\0*.db\0All Files (*.*)\0*.*\0" ;
60- ofn .lpstrDefExt = L"db" ;
61- ofn .lpstrTitle = L"New Database" ;
62- ofn .lpstrInitialDir = szDataPath ;
63- ofn .Flags = OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST ;
64-
65- if (GetSaveFileNameW (& ofn )) {
53+ if (CustomFilePicker (g_hwndMain , szFile , MAX_PATH ,
54+ L"New Database" , L"Database Files (*.db)\0*.db\0" ,
55+ L"db" , szDataPath , 1 )) {
6656 DeleteFileW (szFile );
6757 OpenDatabase (szFile );
6858 }
6959}
7060
7161void DoFileOpen (void ) {
72- CE_OPENFILENAME ofn ;
7362 wchar_t szFile [MAX_PATH ] = L"" ;
7463 wchar_t szDataPath [MAX_PATH ];
7564
7665 /* Get data path (storage card or My Documents) */
7766 GetDataPath (szDataPath , MAX_PATH );
7867
79- memset (& ofn , 0 , sizeof (ofn ));
80- ofn .lStructSize = sizeof (ofn );
81- ofn .hwndOwner = g_hwndMain ;
82- ofn .lpstrFile = szFile ;
83- ofn .nMaxFile = MAX_PATH ;
84- ofn .lpstrFilter = L"Database Files (*.db)\0*.db\0All Files (*.*)\0*.*\0" ;
85- ofn .lpstrTitle = L"Open Database" ;
86- ofn .Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST ;
87- ofn .lpstrInitialDir = szDataPath ;
88-
89- if (GetOpenFileNameW (& ofn )) {
68+ if (CustomFilePicker (g_hwndMain , szFile , MAX_PATH ,
69+ L"Open Database" , L"Database Files (*.db)\0*.db\0" ,
70+ NULL , szDataPath , 0 )) {
9071 OpenDatabase (szFile );
9172 }
9273}
0 commit comments