Something went wrong. Try again.
Reactos
Something went wrong. Try again.
1.6 kB · 76 lines
C
at master
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677/* * PROJECT: ReactOS VGA Font Editor * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) * PURPOSE: Functions for opening and saving files * COPYRIGHT: Copyright 2008 Colin Finck (colin@reactos.org) */
#include "precomp.h"
static OPENFILENAMEW ofn;
VOIDFileInitialize(IN HWND hwnd){ ZeroMemory( &ofn, sizeof(ofn) ); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = L"bin";}
static __inline VOIDPrepareFilter(IN PWSTR pszFilter){ // RC strings can't be double-null terminated, so we use | instead to separate the entries. // Convert them back to null characters here. do { if(*pszFilter == '|') *pszFilter = 0; } while(*++pszFilter);}
BOOLDoOpenFile(OUT PWSTR pszFileName){ BOOL bRet; PWSTR pszFilter;
if( AllocAndLoadString(&pszFilter, IDS_OPENFILTER) ) { PrepareFilter(pszFilter); ofn.lpstrFilter = pszFilter; ofn.lpstrFile = pszFileName; ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
bRet = GetOpenFileNameW(&ofn); HeapFree(hProcessHeap, 0, pszFilter);
return bRet; }
return FALSE;}
BOOLDoSaveFile(IN OUT PWSTR pszFileName){ BOOL bRet; PWSTR pszFilter;
if( AllocAndLoadString(&pszFilter, IDS_SAVEFILTER) ) { PrepareFilter(pszFilter); ofn.lpstrFilter = pszFilter; ofn.lpstrFile = pszFileName;
bRet = GetSaveFileNameW(&ofn); HeapFree(hProcessHeap, 0, pszFilter);
return bRet; }
return FALSE;}