mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[MYDOCS] Simplify HIDA usage
This commit is contained in:
parent
e5ea6041c9
commit
eba16dc9e9
1 changed files with 3 additions and 16 deletions
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(mydocs);
|
WINE_DEFAULT_DEBUG_CHANNEL(mydocs);
|
||||||
|
|
||||||
static CLIPFORMAT g_cfHIDA = 0;
|
|
||||||
|
|
||||||
CMyDocsDropHandler::CMyDocsDropHandler()
|
CMyDocsDropHandler::CMyDocsDropHandler()
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&g_ModuleRefCnt);
|
InterlockedIncrement(&g_ModuleRefCnt);
|
||||||
|
@ -68,23 +66,15 @@ CMyDocsDropHandler::Drop(IDataObject *pDataObject, DWORD dwKeyState,
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// get the clipboard format
|
|
||||||
if (g_cfHIDA == 0)
|
|
||||||
g_cfHIDA = ::RegisterClipboardFormatW(CFSTR_SHELLIDLIST);
|
|
||||||
|
|
||||||
// Retrieve an HIDA (handle of IDA)
|
// Retrieve an HIDA (handle of IDA)
|
||||||
STGMEDIUM medium;
|
CDataObjectHIDA pida(pDataObject);
|
||||||
FORMATETC fmt = { g_cfHIDA, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
if (FAILED_UNEXPECTEDLY(pida.hr()))
|
||||||
hr = pDataObject->GetData(&fmt, &medium);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
|
||||||
{
|
{
|
||||||
*pdwEffect = 0;
|
*pdwEffect = 0;
|
||||||
DragLeave();
|
DragLeave();
|
||||||
return E_FAIL;
|
return pida.hr();
|
||||||
}
|
}
|
||||||
|
|
||||||
// lock HIDA
|
|
||||||
LPIDA pida = reinterpret_cast<LPIDA>(GlobalLock(medium.hGlobal));
|
|
||||||
UINT iItem, cItems = pida->cidl;
|
UINT iItem, cItems = pida->cidl;
|
||||||
|
|
||||||
// get the path of "My Documents"
|
// get the path of "My Documents"
|
||||||
|
@ -123,9 +113,6 @@ CMyDocsDropHandler::Drop(IDataObject *pDataObject, DWORD dwKeyState,
|
||||||
strSrcList += szSrc;
|
strSrcList += szSrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock HIDA
|
|
||||||
GlobalUnlock(medium.hGlobal);
|
|
||||||
|
|
||||||
if (iItem != cItems)
|
if (iItem != cItems)
|
||||||
{
|
{
|
||||||
// source not found
|
// source not found
|
||||||
|
|
Loading…
Reference in a new issue