Author: hbelusca
Date: Sat Dec 12 20:34:21 2015
New Revision: 70328
URL:
http://svn.reactos.org/svn/reactos?rev=70328&view=rev
Log:
[CLIPBRD]
- Display the application icon in program's about dialog.
- Add missing DT_NOPREFIX flag to DrawText() calls.
- Let ShowLastWin32Error() show an error message even if the last error code is zero.
- Remove the calls to OpenClipboard() and CloseClipboard() from the functions in
winutils.c and let the caller open and close the clipboard instead.
Patch by Ricardo Hanke
CORE-10657
Modified:
trunk/reactos/base/applications/clipbrd/clipbrd.c
trunk/reactos/base/applications/clipbrd/winutils.c
Modified: trunk/reactos/base/applications/clipbrd/clipbrd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/clipbrd/…
==============================================================================
--- trunk/reactos/base/applications/clipbrd/clipbrd.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/clipbrd/clipbrd.c [iso-8859-1] Sat Dec 12 20:34:21
2015
@@ -234,8 +234,12 @@
case CMD_ABOUT:
{
WCHAR szTitle[MAX_STRING_LEN];
+ HICON hIcon;
+
+ hIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCE(CLIP_ICON));
LoadStringW(Globals.hInstance, STRING_CLIPBOARD, szTitle,
ARRAYSIZE(szTitle));
- ShellAboutW(Globals.hMainWnd, szTitle, 0, NULL);
+ ShellAboutW(Globals.hMainWnd, szTitle, 0, hIcon);
+ DeleteObject(hIcon);
break;
}
@@ -253,6 +257,11 @@
PAINTSTRUCT ps;
RECT rc;
+ if (!OpenClipboard(NULL))
+ {
+ return;
+ }
+
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rc);
@@ -265,7 +274,7 @@
case CF_UNICODETEXT:
{
- DrawTextFromClipboard(hdc, &rc, DT_LEFT);
+ DrawTextFromClipboard(hdc, &rc, DT_LEFT | DT_NOPREFIX);
break;
}
@@ -301,13 +310,14 @@
default:
{
-
- DrawTextFromResource(Globals.hInstance, ERROR_UNSUPPORTED_FORMAT, hdc,
&rc, DT_CENTER | DT_WORDBREAK);
+ DrawTextFromResource(Globals.hInstance, ERROR_UNSUPPORTED_FORMAT, hdc,
&rc, DT_CENTER | DT_WORDBREAK | DT_NOPREFIX);
break;
}
}
EndPaint(hWnd, &ps);
+
+ CloseClipboard();
}
static LRESULT WINAPI MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Modified: trunk/reactos/base/applications/clipbrd/winutils.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/clipbrd/…
==============================================================================
--- trunk/reactos/base/applications/clipbrd/winutils.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/clipbrd/winutils.c [iso-8859-1] Sat Dec 12 20:34:21
2015
@@ -14,8 +14,6 @@
LPWSTR lpMsgBuf = NULL;
dwError = GetLastError();
- if (dwError == NO_ERROR)
- return;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, 0, (LPWSTR)&lpMsgBuf, 0, NULL);
@@ -73,9 +71,6 @@
HGLOBAL hGlobal;
LPWSTR lpchText;
- if (!OpenClipboard(NULL))
- return;
-
hGlobal = GetClipboardData(CF_UNICODETEXT);
if (!hGlobal)
return;
@@ -86,16 +81,12 @@
DrawTextW(hDC, lpchText, -1, lpRect, uFormat);
GlobalUnlock(hGlobal);
- CloseClipboard();
}
void BitBltFromClipboard(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
int nXSrc, int nYSrc, DWORD dwRop)
{
HDC hdcMem;
HBITMAP hbm;
-
- if (!OpenClipboard(NULL))
- return;
hdcMem = CreateCompatibleDC(hdcDest);
if (hdcMem)
@@ -105,7 +96,6 @@
BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcMem, nXSrc, nYSrc, dwRop);
DeleteDC(hdcMem);
}
- CloseClipboard();
}
void SetDIBitsToDeviceFromClipboard(UINT uFormat, HDC hdc, int XDest, int YDest, int
XSrc, int YSrc, UINT uStartScan, UINT fuColorUse)
@@ -114,9 +104,6 @@
LPBYTE lpBits;
HGLOBAL hGlobal;
INT iPalSize;
-
- if (!OpenClipboard(NULL))
- return;
hGlobal = GetClipboardData(uFormat);
if (!hGlobal)
@@ -140,16 +127,12 @@
SetDIBitsToDevice(hdc, XDest, YDest, lpInfoHeader->biWidth,
lpInfoHeader->biHeight, XSrc, YSrc, uStartScan, lpInfoHeader->biHeight, lpBits,
(LPBITMAPINFO)lpInfoHeader, fuColorUse);
GlobalUnlock(hGlobal);
- CloseClipboard();
}
void PlayMetaFileFromClipboard(HDC hdc, const RECT *lpRect)
{
LPMETAFILEPICT mp;
HGLOBAL hGlobal;
-
- if (!OpenClipboard(NULL))
- return;
hGlobal = GetClipboardData(CF_METAFILEPICT);
if (!hGlobal)
@@ -164,17 +147,12 @@
SetViewportOrgEx(hdc, lpRect->left, lpRect->top, NULL);
PlayMetaFile(hdc, mp->hMF);
GlobalUnlock(hGlobal);
- CloseClipboard();
}
void PlayEnhMetaFileFromClipboard(HDC hdc, const RECT *lpRect)
{
HENHMETAFILE hEmf;
- if (!OpenClipboard(NULL))
- return;
-
hEmf = GetClipboardData(CF_ENHMETAFILE);
PlayEnhMetaFile(hdc, hEmf, lpRect);
- CloseClipboard();
}