Skip to content

Commit ba53f72

Browse files
authored
[MSPAINT] Send mail with image (retry) (reactos#5404)
- Add OpenMailer function. - Add IDS_CANTSENDMAIL. - Send a mail by using mapi32!MAPISendMail/W. - Extend SaveDIBToFile function by adding a parameter. CORE-19094
1 parent 3463a3f commit ba53f72

36 files changed

+159
-3
lines changed

base/applications/mspaint/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ BOOL zoomTo(int newZoom, int mouseX, int mouseY);
4747
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1);
4848
void updateStartAndLast(LONG x, LONG y);
4949
void updateLast(LONG x, LONG y);
50+
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName);

base/applications/mspaint/dib.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ GetDIBHeight(HBITMAP hBitmap)
142142
return bm.bmHeight;
143143
}
144144

145-
BOOL SaveDIBToFile(HBITMAP hBitmap, LPCWSTR FileName, BOOL fIsMainFile)
145+
BOOL SaveDIBToFile(HBITMAP hBitmap, LPCWSTR FileName, BOOL fIsMainFile, REFGUID guidFileType)
146146
{
147147
CImageDx img;
148148
img.Attach(hBitmap);
149-
HRESULT hr = img.SaveDx(FileName, GUID_NULL, g_xDpi, g_yDpi);
149+
HRESULT hr = img.SaveDx(FileName, guidFileType, g_xDpi, g_yDpi);
150150
img.Detach();
151151

152152
if (FAILED(hr))

base/applications/mspaint/dib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static inline HBITMAP CopyDIBImage(HBITMAP hbm, INT cx = 0, INT cy = 0)
2222
int GetDIBWidth(HBITMAP hbm);
2323
int GetDIBHeight(HBITMAP hbm);
2424

25-
BOOL SaveDIBToFile(HBITMAP hBitmap, LPCWSTR FileName, BOOL fIsMainFile);
25+
BOOL SaveDIBToFile(HBITMAP hBitmap, LPCWSTR FileName, BOOL fIsMainFile, REFGUID guidFileType = GUID_NULL);
2626

2727
HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile);
2828

base/applications/mspaint/lang/bg-BG.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/cs-CZ.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/de-DE.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d pixel/cm"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/en-GB.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d dots per inch"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/en-US.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d dots per inch"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/es-ES.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,5 @@ BEGIN
265265
IDS_PRINTRES "%d x %d pixel/cm"
266266
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
267267
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
268+
IDS_CANTSENDMAIL "Failed to send a mail."
268269
END

base/applications/mspaint/lang/et-EE.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d pixel/cm"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/eu-ES.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/fr-FR.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/he-IL.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,5 @@ BEGIN
265265
IDS_PRINTRES "%d x %d pixel/cm"
266266
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
267267
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
268+
IDS_CANTSENDMAIL "Failed to send a mail."
268269
END

base/applications/mspaint/lang/hu-HU.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/id-ID.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d pixel/cm"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/it-IT.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/ja-JP.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,5 @@ BEGIN
264264
IDS_PRINTRES "%d x %d ピクセル/cm"
265265
IDS_CANTPASTE "クリップボードからの貼り付けに失敗しました。データ形式が間違っているか、未対応です。"
266266
IDS_SAVEERROR "次のファイルとして画像を保存するのに失敗しました:\n\n%s"
267+
IDS_CANTSENDMAIL "Failed to send a mail."
267268
END

base/applications/mspaint/lang/nl-NL.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d pixel/cm"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/no-NO.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d pixel/cm"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/pl-PL.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,5 @@ BEGIN
265265
IDS_PRINTRES "%d x %d piksel/cm"
266266
IDS_CANTPASTE "Nie można wkleić ze schowka. Format danych jest nieprawidłowy lub nieobsługiwany."
267267
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
268+
IDS_CANTSENDMAIL "Failed to send a mail."
268269
END

base/applications/mspaint/lang/pt-BR.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/pt-PT.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/ro-RO.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,5 @@ BEGIN
264264
IDS_PRINTRES "%d x %d pixeli/cm"
265265
IDS_CANTPASTE "Nu a putut fi lipit din clipboard. Formatul de date este fie incorect, fie nesuportat."
266266
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
267+
IDS_CANTSENDMAIL "Failed to send a mail."
267268
END

base/applications/mspaint/lang/ru-RU.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,5 @@ BEGIN
266266
IDS_PRINTRES "%d x %d точек/см"
267267
IDS_CANTPASTE "Не удалось вставить из буфера обмена. Формат данных либо некорректный, либо не поддерживается."
268268
IDS_SAVEERROR "Не удалось сохранить точечный рисунок в файл:\n\n%s"
269+
IDS_CANTSENDMAIL "Failed to send a mail."
269270
END

base/applications/mspaint/lang/sk-SK.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d pixel/cm"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/sq-AL.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d pixel/cm"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/sv-SE.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/tr-TR.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/uk-UA.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,5 @@ BEGIN
264264
IDS_PRINTRES "%d x %d pixel/cm"
265265
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
266266
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
267+
IDS_CANTSENDMAIL "Failed to send a mail."
267268
END

base/applications/mspaint/lang/vi-VN.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ BEGIN
262262
IDS_PRINTRES "%d x %d pixel/cm"
263263
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
264264
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
265+
IDS_CANTSENDMAIL "Failed to send a mail."
265266
END

base/applications/mspaint/lang/zh-CN.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,5 @@ BEGIN
265265
IDS_PRINTRES "%d x %d pixel/cm"
266266
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
267267
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
268+
IDS_CANTSENDMAIL "Failed to send a mail."
268269
END

base/applications/mspaint/lang/zh-HK.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/lang/zh-TW.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ BEGIN
263263
IDS_PRINTRES "%d x %d pixel/cm"
264264
IDS_CANTPASTE "Failed to paste from the clipboard. The data format is either incorrect or not supported."
265265
IDS_SAVEERROR "Failed to save the bitmap to file:\n\n%s"
266+
IDS_CANTSENDMAIL "Failed to send a mail."
266267
END

base/applications/mspaint/main.cpp

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77

88
#include "precomp.h"
99

10+
#include <mapi.h>
11+
#include <mapicode.h>
12+
1013
POINT g_ptStart, g_ptEnd;
1114
BOOL g_askBeforeEnlarging = FALSE; // TODO: initialize from registry
1215
HINSTANCE g_hinstExe = NULL;
1316
TCHAR g_szFileName[MAX_LONG_PATH] = { 0 };
17+
WCHAR g_szMailTempFile[MAX_LONG_PATH] = { 0 };
1418
BOOL g_isAFile = FALSE;
1519
BOOL g_imageSaved = FALSE;
1620
BOOL g_showGrid = FALSE;
@@ -69,6 +73,116 @@ OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
6973
return 0;
7074
}
7175

76+
typedef ULONG (WINAPI *FN_MAPISendMail)(LHANDLE, ULONG_PTR, lpMapiMessage, FLAGS, ULONG);
77+
typedef ULONG (WINAPI *FN_MAPISendMailW)(LHANDLE, ULONG_PTR, lpMapiMessageW, FLAGS, ULONG);
78+
79+
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
80+
{
81+
// Delete the temporary file if any
82+
if (g_szMailTempFile[0])
83+
{
84+
::DeleteFileW(g_szMailTempFile);
85+
g_szMailTempFile[0] = UNICODE_NULL;
86+
}
87+
88+
CStringW strFileTitle;
89+
if (PathFileExistsW(pszPathName) && imageModel.IsImageSaved())
90+
{
91+
strFileTitle = PathFindFileNameW(pszPathName);
92+
}
93+
else // Not existing or not saved
94+
{
95+
// Get the name of a temporary file
96+
WCHAR szTempDir[MAX_PATH];
97+
::GetTempPathW(_countof(szTempDir), szTempDir);
98+
if (!::GetTempFileNameW(szTempDir, L"afx", 0, g_szMailTempFile))
99+
return FALSE; // Failure
100+
101+
if (PathFileExistsW(g_szFileName))
102+
{
103+
// Set file title
104+
strFileTitle = PathFindFileNameW(g_szFileName);
105+
106+
// Copy to the temporary file
107+
if (!::CopyFileW(g_szFileName, g_szMailTempFile, FALSE))
108+
{
109+
g_szMailTempFile[0] = UNICODE_NULL;
110+
return FALSE; // Failure
111+
}
112+
}
113+
else
114+
{
115+
// Set file title
116+
strFileTitle.LoadString(IDS_DEFAULTFILENAME);
117+
strFileTitle += L".png";
118+
119+
// Save it to the temporary file
120+
HBITMAP hbm = imageModel.CopyBitmap();
121+
BOOL ret = SaveDIBToFile(hbm, g_szMailTempFile, FALSE, Gdiplus::ImageFormatPNG);
122+
::DeleteObject(hbm);
123+
if (!ret)
124+
{
125+
g_szMailTempFile[0] = UNICODE_NULL;
126+
return FALSE; // Failure
127+
}
128+
}
129+
130+
// Use the temporary file
131+
pszPathName = g_szMailTempFile;
132+
}
133+
134+
// Load "mapi32.dll"
135+
HINSTANCE hMAPI = LoadLibraryW(L"mapi32.dll");
136+
if (!hMAPI)
137+
return FALSE; // Failure
138+
139+
// Attachment
140+
MapiFileDescW attachmentW = { 0 };
141+
attachmentW.nPosition = (ULONG)-1;
142+
attachmentW.lpszPathName = (LPWSTR)pszPathName;
143+
attachmentW.lpszFileName = (LPWSTR)(LPCWSTR)strFileTitle;
144+
145+
// Message with attachment
146+
MapiMessageW messageW = { 0 };
147+
messageW.lpszSubject = NULL;
148+
messageW.nFileCount = 1;
149+
messageW.lpFiles = &attachmentW;
150+
151+
// First, try to open the mailer by the function of Unicode version
152+
FN_MAPISendMailW pMAPISendMailW = (FN_MAPISendMailW)::GetProcAddress(hMAPI, "MAPISendMailW");
153+
if (pMAPISendMailW)
154+
{
155+
pMAPISendMailW(0, (ULONG_PTR)hWnd, &messageW, MAPI_DIALOG | MAPI_LOGON_UI, 0);
156+
::FreeLibrary(hMAPI);
157+
return TRUE; // MAPISendMailW will show an error message on failure
158+
}
159+
160+
// Convert to ANSI strings
161+
CStringA szPathNameA(pszPathName), szFileTitleA(strFileTitle);
162+
163+
MapiFileDesc attachment = { 0 };
164+
attachment.nPosition = (ULONG)-1;
165+
attachment.lpszPathName = (LPSTR)(LPCSTR)szPathNameA;
166+
attachment.lpszFileName = (LPSTR)(LPCSTR)szFileTitleA;
167+
168+
MapiMessage message = { 0 };
169+
message.lpszSubject = NULL;
170+
message.nFileCount = 1;
171+
message.lpFiles = &attachment;
172+
173+
// Try again but in ANSI version
174+
FN_MAPISendMail pMAPISendMail = (FN_MAPISendMail)::GetProcAddress(hMAPI, "MAPISendMail");
175+
if (pMAPISendMail)
176+
{
177+
pMAPISendMail(0, (ULONG_PTR)hWnd, &message, MAPI_DIALOG | MAPI_LOGON_UI, 0);
178+
::FreeLibrary(hMAPI);
179+
return TRUE; // MAPISendMail will show an error message on failure
180+
}
181+
182+
::FreeLibrary(hMAPI);
183+
return FALSE; // Failure
184+
}
185+
72186
BOOL CMainWindow::GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
73187
{
74188
static OPENFILENAME ofn = { 0 };
@@ -238,6 +352,9 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC
238352
// Write back settings to registry
239353
registrySettings.Store();
240354

355+
if (g_szMailTempFile[0])
356+
::DeleteFileW(g_szMailTempFile);
357+
241358
// Return the value that PostQuitMessage() gave
242359
return (INT)msg.wParam;
243360
}

base/applications/mspaint/resource.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,4 @@
221221
#define IDS_PRINTRES 939
222222
#define IDS_CANTPASTE 940
223223
#define IDS_SAVEERROR 941
224+
#define IDS_CANTSENDMAIL 942

base/applications/mspaint/winproc.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,13 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
666666
if (pd.hDevNames)
667667
GlobalFree(pd.hDevNames);
668668
break;
669+
case IDM_FILESEND:
670+
canvasWindow.finishDrawing();
671+
if (!OpenMailer(m_hWnd, g_szFileName))
672+
{
673+
ShowError(IDS_CANTSENDMAIL);
674+
}
675+
break;
669676
case IDM_FILEASWALLPAPERPLANE:
670677
RegistrySettings::SetWallpaper(g_szFileName, RegistrySettings::TILED);
671678
break;

0 commit comments

Comments
 (0)