2 * PROJECT: ReactOS VGA Font Editor
3 * LICENSE: GNU General Public License Version 2.0 or any later version
4 * FILE: devutils/vgafontedit/opensave.c
5 * PURPOSE: Functions for opening and saving files
6 * COPYRIGHT: Copyright 2008 Colin Finck <mail@colinfinck.de>
11 static OPENFILENAMEW ofn
;
14 FileInitialize(IN HWND hwnd
)
16 ZeroMemory( &ofn
, sizeof(ofn
) );
17 ofn
.lStructSize
= sizeof(ofn
);
19 ofn
.nMaxFile
= MAX_PATH
;
20 ofn
.lpstrDefExt
= L
"bin";
24 PrepareFilter(IN PWSTR pszFilter
)
26 // RC strings can't be double-null terminated, so we use | instead to separate the entries.
27 // Convert them back to null characters here.
37 DoOpenFile(OUT PWSTR pszFileName
)
42 if( AllocAndLoadString(&pszFilter
, IDS_OPENFILTER
) )
44 PrepareFilter(pszFilter
);
45 ofn
.lpstrFilter
= pszFilter
;
46 ofn
.lpstrFile
= pszFileName
;
47 ofn
.Flags
= OFN_FILEMUSTEXIST
;
49 bRet
= GetOpenFileNameW(&ofn
);
50 HeapFree(hProcessHeap
, 0, pszFilter
);
59 DoSaveFile(IN OUT PWSTR pszFileName
)
64 if( AllocAndLoadString(&pszFilter
, IDS_SAVEFILTER
) )
66 PrepareFilter(pszFilter
);
67 ofn
.lpstrFilter
= pszFilter
;
68 ofn
.lpstrFile
= pszFileName
;
70 bRet
= GetSaveFileNameW(&ofn
);
71 HeapFree(hProcessHeap
, 0, pszFilter
);