mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 15:08:14 +00:00
[CLIPBRD] Support CF_HDROP format (#5622)
This allows to see what files are being copied into clipboard. CORE-19140
This commit is contained in:
parent
657f728767
commit
f90a1956a5
4 changed files with 49 additions and 1 deletions
|
@ -358,6 +358,13 @@ static void OnPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CF_HDROP:
|
||||||
|
{
|
||||||
|
GetClientRect(hWnd, &rc);
|
||||||
|
HDropFromClipboard(hdc, &rc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
GetClientRect(hWnd, &rc);
|
GetClientRect(hWnd, &rc);
|
||||||
|
|
|
@ -164,7 +164,8 @@ UINT GetAutomaticClipboardFormat(void)
|
||||||
CF_DSPBITMAP,
|
CF_DSPBITMAP,
|
||||||
CF_DSPMETAFILEPICT,
|
CF_DSPMETAFILEPICT,
|
||||||
CF_DSPENHMETAFILE,
|
CF_DSPENHMETAFILE,
|
||||||
CF_PALETTE
|
CF_PALETTE,
|
||||||
|
CF_HDROP
|
||||||
};
|
};
|
||||||
|
|
||||||
return GetPriorityClipboardFormat(uFormatList, ARRAYSIZE(uFormatList));
|
return GetPriorityClipboardFormat(uFormatList, ARRAYSIZE(uFormatList));
|
||||||
|
|
|
@ -331,6 +331,45 @@ void PlayEnhMetaFileFromClipboard(HDC hdc, const RECT *lpRect)
|
||||||
PlayEnhMetaFile(hdc, hEmf, lpRect);
|
PlayEnhMetaFile(hdc, hEmf, lpRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LPWSTR AllocStrCat(LPWSTR psz, LPCWSTR cat)
|
||||||
|
{
|
||||||
|
INT cch;
|
||||||
|
LPWSTR pszNew;
|
||||||
|
|
||||||
|
if (psz == NULL)
|
||||||
|
return _wcsdup(cat);
|
||||||
|
|
||||||
|
cch = lstrlenW(psz) + lstrlenW(cat) + 1;
|
||||||
|
pszNew = realloc(psz, cch * sizeof(WCHAR));
|
||||||
|
if (!pszNew)
|
||||||
|
return psz;
|
||||||
|
|
||||||
|
lstrcatW(pszNew, cat);
|
||||||
|
return pszNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HDropFromClipboard(HDC hdc, const RECT *lpRect)
|
||||||
|
{
|
||||||
|
LPWSTR pszAlloc = NULL;
|
||||||
|
WCHAR szFile[MAX_PATH + 2];
|
||||||
|
HDROP hDrop = (HDROP)GetClipboardData(CF_HDROP);
|
||||||
|
UINT iFile, cFiles = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
|
||||||
|
RECT rc = *lpRect;
|
||||||
|
|
||||||
|
FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW + 1));
|
||||||
|
|
||||||
|
for (iFile = 0; iFile < cFiles; ++iFile)
|
||||||
|
{
|
||||||
|
DragQueryFileW(hDrop, iFile, szFile, _countof(szFile));
|
||||||
|
lstrcatW(szFile, L"\r\n");
|
||||||
|
pszAlloc = AllocStrCat(pszAlloc, szFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawTextW(hdc, pszAlloc, -1, &rc,
|
||||||
|
DT_LEFT | DT_NOPREFIX | DT_EXTERNALLEADING | DT_WORD_ELLIPSIS);
|
||||||
|
free(pszAlloc);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL RealizeClipboardPalette(HDC hdc)
|
BOOL RealizeClipboardPalette(HDC hdc)
|
||||||
{
|
{
|
||||||
BOOL Success;
|
BOOL Success;
|
||||||
|
|
|
@ -17,4 +17,5 @@ void BitBltFromClipboard(PAINTSTRUCT ps, SCROLLSTATE state, DWORD dwRop);
|
||||||
void SetDIBitsToDeviceFromClipboard(UINT uFormat, PAINTSTRUCT ps, SCROLLSTATE state, UINT fuColorUse);
|
void SetDIBitsToDeviceFromClipboard(UINT uFormat, PAINTSTRUCT ps, SCROLLSTATE state, UINT fuColorUse);
|
||||||
void PlayMetaFileFromClipboard(HDC hdc, const RECT *lpRect);
|
void PlayMetaFileFromClipboard(HDC hdc, const RECT *lpRect);
|
||||||
void PlayEnhMetaFileFromClipboard(HDC hdc, const RECT *lpRect);
|
void PlayEnhMetaFileFromClipboard(HDC hdc, const RECT *lpRect);
|
||||||
|
void HDropFromClipboard(HDC hdc, const RECT *lpRect);
|
||||||
BOOL RealizeClipboardPalette(HDC hdc);
|
BOOL RealizeClipboardPalette(HDC hdc);
|
||||||
|
|
Loading…
Reference in a new issue