mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 19:21:38 +00:00
[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 svn path=/trunk/; revision=70328
This commit is contained in:
parent
c1d7cca159
commit
1153d6397c
2 changed files with 14 additions and 26 deletions
|
@ -234,8 +234,12 @@ static int ClipboardCommandHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
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 @@ static void ClipboardPaintHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
|
||||
if (!OpenClipboard(NULL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
GetClientRect(hWnd, &rc);
|
||||
|
||||
|
@ -265,7 +274,7 @@ static void ClipboardPaintHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
|
||||
case CF_UNICODETEXT:
|
||||
{
|
||||
DrawTextFromClipboard(hdc, &rc, DT_LEFT);
|
||||
DrawTextFromClipboard(hdc, &rc, DT_LEFT | DT_NOPREFIX);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -301,13 +310,14 @@ static void ClipboardPaintHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
|
||||
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)
|
||||
|
|
|
@ -14,8 +14,6 @@ void ShowLastWin32Error(HWND hwndParent)
|
|||
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 @@ void DrawTextFromClipboard(HDC hDC, LPRECT lpRect, UINT uFormat)
|
|||
HGLOBAL hGlobal;
|
||||
LPWSTR lpchText;
|
||||
|
||||
if (!OpenClipboard(NULL))
|
||||
return;
|
||||
|
||||
hGlobal = GetClipboardData(CF_UNICODETEXT);
|
||||
if (!hGlobal)
|
||||
return;
|
||||
|
@ -86,7 +81,6 @@ void DrawTextFromClipboard(HDC hDC, LPRECT lpRect, UINT uFormat)
|
|||
|
||||
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)
|
||||
|
@ -94,9 +88,6 @@ void BitBltFromClipboard(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
|||
HDC hdcMem;
|
||||
HBITMAP hbm;
|
||||
|
||||
if (!OpenClipboard(NULL))
|
||||
return;
|
||||
|
||||
hdcMem = CreateCompatibleDC(hdcDest);
|
||||
if (hdcMem)
|
||||
{
|
||||
|
@ -105,7 +96,6 @@ void BitBltFromClipboard(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
|||
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)
|
||||
|
@ -115,9 +105,6 @@ void SetDIBitsToDeviceFromClipboard(UINT uFormat, HDC hdc, int XDest, int YDest,
|
|||
HGLOBAL hGlobal;
|
||||
INT iPalSize;
|
||||
|
||||
if (!OpenClipboard(NULL))
|
||||
return;
|
||||
|
||||
hGlobal = GetClipboardData(uFormat);
|
||||
if (!hGlobal)
|
||||
return;
|
||||
|
@ -140,7 +127,6 @@ void SetDIBitsToDeviceFromClipboard(UINT uFormat, HDC hdc, int XDest, int YDest,
|
|||
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)
|
||||
|
@ -148,9 +134,6 @@ void PlayMetaFileFromClipboard(HDC hdc, const RECT *lpRect)
|
|||
LPMETAFILEPICT mp;
|
||||
HGLOBAL hGlobal;
|
||||
|
||||
if (!OpenClipboard(NULL))
|
||||
return;
|
||||
|
||||
hGlobal = GetClipboardData(CF_METAFILEPICT);
|
||||
if (!hGlobal)
|
||||
return;
|
||||
|
@ -164,17 +147,12 @@ void PlayMetaFileFromClipboard(HDC hdc, const RECT *lpRect)
|
|||
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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue