ReactOS  0.4.14-dev-55-g2da92ac
opensave.c File Reference
#include "precomp.h"
Include dependency graph for opensave.c:

Go to the source code of this file.

Functions

VOID FileInitialize (IN HWND hwnd)
 
static __inline VOID PrepareFilter (IN PWSTR pszFilter)
 
BOOL DoOpenFile (OUT PWSTR pszFileName)
 
BOOL DoSaveFile (IN OUT PWSTR pszFileName)
 

Variables

static OPENFILENAMEW ofn
 

Function Documentation

◆ DoOpenFile()

BOOL DoOpenFile ( OUT PWSTR  pszFileName)

Definition at line 36 of file opensave.c.

37 {
38  BOOL bRet;
39  PWSTR pszFilter;
40 
41  if( AllocAndLoadString(&pszFilter, IDS_OPENFILTER) )
42  {
43  PrepareFilter(pszFilter);
44  ofn.lpstrFilter = pszFilter;
47 
48  bRet = GetOpenFileNameW(&ofn);
49  HeapFree(hProcessHeap, 0, pszFilter);
50 
51  return bRet;
52  }
53 
54  return FALSE;
55 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
DWORD Flags
Definition: commdlg.h:373
LPCWSTR lpstrFilter
Definition: commdlg.h:363
uint16_t * PWSTR
Definition: typedefs.h:54
LPWSTR lpstrFile
Definition: commdlg.h:367
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
#define IDS_OPENFILTER
Definition: resource.h:59
static OPENFILENAMEW ofn
Definition: opensave.c:10
static __inline VOID PrepareFilter(IN PWSTR pszFilter)
Definition: opensave.c:23
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4564
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
#define HeapFree(x, y, z)
Definition: compat.h:394
HANDLE hProcessHeap
Definition: kbswitch.c:25

◆ DoSaveFile()

BOOL DoSaveFile ( IN OUT PWSTR  pszFileName)

Definition at line 58 of file opensave.c.

59 {
60  BOOL bRet;
61  PWSTR pszFilter;
62 
63  if( AllocAndLoadString(&pszFilter, IDS_SAVEFILTER) )
64  {
65  PrepareFilter(pszFilter);
66  ofn.lpstrFilter = pszFilter;
68 
69  bRet = GetSaveFileNameW(&ofn);
70  HeapFree(hProcessHeap, 0, pszFilter);
71 
72  return bRet;
73  }
74 
75  return FALSE;
76 }
LPCWSTR lpstrFilter
Definition: commdlg.h:363
uint16_t * PWSTR
Definition: typedefs.h:54
LPWSTR lpstrFile
Definition: commdlg.h:367
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4629
static OPENFILENAMEW ofn
Definition: opensave.c:10
static __inline VOID PrepareFilter(IN PWSTR pszFilter)
Definition: opensave.c:23
unsigned int BOOL
Definition: ntddk_ex.h:94
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
#define IDS_SAVEFILTER
Definition: resource.h:60
#define HeapFree(x, y, z)
Definition: compat.h:394
HANDLE hProcessHeap
Definition: kbswitch.c:25

◆ FileInitialize()

VOID FileInitialize ( IN HWND  hwnd)

Definition at line 13 of file opensave.c.

14 {
15  ZeroMemory( &ofn, sizeof(ofn) );
16  ofn.lStructSize = sizeof(ofn);
17  ofn.hwndOwner = hwnd;
19  ofn.lpstrDefExt = L"bin";
20 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ZeroMemory
Definition: winbase.h:1635
DWORD lStructSize
Definition: commdlg.h:360
static OPENFILENAMEW ofn
Definition: opensave.c:10
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
#define MAX_PATH
Definition: compat.h:26
DWORD nMaxFile
Definition: commdlg.h:368
HWND hwndOwner
Definition: commdlg.h:361
static const WCHAR L[]
Definition: oid.c:1250

Referenced by InitMainWnd().

◆ PrepareFilter()

static __inline VOID PrepareFilter ( IN PWSTR  pszFilter)
static

Definition at line 23 of file opensave.c.

24 {
25  // RC strings can't be double-null terminated, so we use | instead to separate the entries.
26  // Convert them back to null characters here.
27  do
28  {
29  if(*pszFilter == '|')
30  *pszFilter = 0;
31  }
32  while(*++pszFilter);
33 }

Referenced by DoOpenFile(), and DoSaveFile().

Variable Documentation

◆ ofn

OPENFILENAMEW ofn
static

Definition at line 10 of file opensave.c.

Referenced by DoOpenFile(), DoSaveFile(), and FileInitialize().