ReactOS 0.4.15-dev-5666-gc548b97
opensave.c File Reference
#include "precomp.h"
Include dependency graph for opensave.c:

Go to the source code of this file.

Functions

VOID FileInitialize (HWND hwnd)
 
static BOOL DoWriteFile (LPCTSTR pszFileName)
 
BOOL DoOpenFile (HWND hwnd, LPTSTR szFileName, LPTSTR szTitleName)
 
BOOL DoSaveFile (HWND hwnd)
 

Variables

static OPENFILENAME ofn
 

Function Documentation

◆ DoOpenFile()

BOOL DoOpenFile ( HWND  hwnd,
LPTSTR  szFileName,
LPTSTR  szTitleName 
)

Definition at line 27 of file opensave.c.

30{
31 DWORD err;
32
33 static TCHAR Filter[] = _T("All documents (*.txt,*.rtf)\0*.txt;*.rtf\0") \
34 _T("Rich Text Document (*.rtf)\0*.rtf\0") \
35 _T("Text Document (*.txt)\0*.txt\0");
36
37
39 ofn.lpstrFile = szFileName;
40 ofn.lpstrFileTitle = szTitleName;
42
43 if (GetOpenFileName(&ofn))
44 {
45 return TRUE;
46 }
47
49
51 MessageBox(NULL, _T("Open file failed"), NULL, 0);
52
53 return FALSE;
54}
static OPENFILENAMEW ofn
Definition: opensave.c:10
#define CDERR_GENERALCODES
Definition: cderr.h:5
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:148
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define GetOpenFileName
Definition: commdlg.h:665
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
#define err(...)
DWORD Flags
Definition: commdlg.h:373
LPWSTR lpstrFile
Definition: commdlg.h:367
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
LPCWSTR lpstrFilter
Definition: commdlg.h:363
#define _T(x)
Definition: vfdio.h:22
#define MessageBox
Definition: winuser.h:5812
char TCHAR
Definition: xmlstorage.h:189

◆ DoSaveFile()

BOOL DoSaveFile ( HWND  hwnd)

Definition at line 59 of file opensave.c.

60{
61 TCHAR szFileName[MAX_PATH] = _T("");
62 static TCHAR Filter[] = _T("Rich Text Document (*.rtf)\0*.rtf\0") \
63 _T("Text Document (*.txt)\0*.txt\0");
64
66 ofn.lpstrFile = szFileName;
68
69 if (GetSaveFileName(&ofn))
70 {
71 if (DoWriteFile(szFileName))
72 return TRUE;
73 }
74
76 MessageBox(NULL, _T("Save to file failed"), NULL, 0);
77
78 return FALSE;
79}
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define GetSaveFileName
Definition: commdlg.h:666
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
#define MAX_PATH
Definition: compat.h:34
static BOOL DoWriteFile(LPCTSTR pszFileName)
Definition: opensave.c:20

◆ DoWriteFile()

static BOOL DoWriteFile ( LPCTSTR  pszFileName)
static

Definition at line 20 of file opensave.c.

21{
22 return TRUE;
23}

Referenced by DoSaveFile().

◆ FileInitialize()

VOID FileInitialize ( HWND  hwnd)

Definition at line 8 of file opensave.c.

9{
10 ZeroMemory(&ofn, sizeof(ofn));
15 ofn.lpstrDefExt = _T("bmp");
16}
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
HWND hwndOwner
Definition: commdlg.h:361
DWORD nMaxFileTitle
Definition: commdlg.h:370
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
DWORD lStructSize
Definition: commdlg.h:360
DWORD nMaxFile
Definition: commdlg.h:368
#define ZeroMemory
Definition: winbase.h:1670
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Variable Documentation

◆ ofn

OPENFILENAME ofn
static

Definition at line 3 of file opensave.c.