ReactOS  0.4.13-dev-443-g10f00f8
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  /*static TCHAR Filter[] = _T("All image files (*.gif,*.bmp,*.jpg,*.jpeg,*.tif,*.png)\0*.gif,*.bmp,*.jpg,*.jpeg,*.tif,*.png\0") \
33  _T("All files (*.*)\0*.*\0") \
34  _T("Graphics Interchange format (*gif)\0*.gif\0") \
35  _T("Windows Bitmap (*bmp)\0*.bmp\0") \
36  _T("JPEG File Interchange Format (*jpg,*.jpeg)\0*.jpg,*.jpeg\0") \
37  _T("TAG Image File Format (*tif)\0*.tif\0") \
38  _T("Portable Network Graphics (*png)\0*.png\0\0");*/
39 
40  static TCHAR Filter[] = _T("Windows Bitmap (*.bmp)\0*.bmp\0");
41 
43  ofn.lpstrFile = szFileName;
44  ofn.lpstrFileTitle = szTitleName;
46 
47  if (GetOpenFileName(&ofn))
48  {
49  return TRUE;
50  }
51 
53 
54  if (err != CDERR_GENERALCODES)
55  MessageBox(NULL, _T("Open file failed"), NULL, 0);
56 
57  return FALSE;
58 }
#define CDERR_GENERALCODES
Definition: cderr.h:5
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
#define TRUE
Definition: types.h:120
LPSTR lpstrFileTitle
Definition: commdlg.h:338
#define GetOpenFileName
Definition: commdlg.h:665
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
static OPENFILENAME ofn
Definition: opensave.c:3
unsigned long DWORD
Definition: ntddk_ex.h:95
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define MessageBox
Definition: winuser.h:5688
#define err(...)
LPSTR lpstrFile
Definition: commdlg.h:336
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
DWORD Flags
Definition: commdlg.h:342

◆ DoSaveFile()

BOOL DoSaveFile ( HWND  hwnd)

Definition at line 63 of file opensave.c.

64 {
65  TCHAR szFileName[MAX_PATH] = _T("");
66  static TCHAR Filter[] = _T("Graphics Interchange format (*gif)\0*.gif\0") \
67  _T("Windows Bitmap (*bmp)\0*.bmp\0") \
68  _T("JPEG File Interchange Format (*jpg,*.jpeg)\0*.jpg,*.jpeg\0") \
69  _T("TAG Image File Format (*tif)\0*.tif\0") \
70  _T("Portable Network Graphics (*png)\0*.png\0\0");
71 
73  ofn.lpstrFile = szFileName;
75 
76  if (GetSaveFileName(&ofn))
77  {
78  if (DoWriteFile(szFileName))
79  return TRUE;
80  }
81 
83  MessageBox(NULL, _T("Save to file failed"), NULL, 0);
84 
85  return FALSE;
86 }
#define CDERR_GENERALCODES
Definition: cderr.h:5
#define OFN_EXPLORER
Definition: commdlg.h:104
#define TRUE
Definition: types.h:120
#define GetSaveFileName
Definition: commdlg.h:666
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
smooth NULL
Definition: ftsmooth.c:416
static BOOL DoWriteFile(LPCTSTR pszFileName)
Definition: opensave.c:20
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
static OPENFILENAME ofn
Definition: opensave.c:3
#define MAX_PATH
Definition: compat.h:26
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define MessageBox
Definition: winuser.h:5688
LPSTR lpstrFile
Definition: commdlg.h:336
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
DWORD Flags
Definition: commdlg.h:342

◆ DoWriteFile()

static BOOL DoWriteFile ( LPCTSTR  pszFileName)
static

Definition at line 20 of file opensave.c.

21 {
22  return TRUE;
23 }
#define TRUE
Definition: types.h:120

Referenced by DoSaveFile().

◆ FileInitialize()

VOID FileInitialize ( HWND  hwnd)

Definition at line 8 of file opensave.c.

9 {
10  ZeroMemory(&ofn, sizeof(ofn));
11  ofn.lStructSize = sizeof(OPENFILENAME);
12  ofn.hwndOwner = hwnd;
15  ofn.lpstrDefExt = _T("bmp");
16 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND hwndOwner
Definition: commdlg.h:330
#define ZeroMemory
Definition: winbase.h:1635
LPCSTR lpstrDefExt
Definition: commdlg.h:345
DWORD nMaxFile
Definition: commdlg.h:337
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
#define _T(x)
Definition: vfdio.h:22
static OPENFILENAME ofn
Definition: opensave.c:3
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
DWORD nMaxFileTitle
Definition: commdlg.h:339

Variable Documentation

◆ ofn

OPENFILENAME ofn
static

Definition at line 3 of file opensave.c.

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