MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / HandleLeftClickDrop

Method HandleLeftClickDrop

Explorer++/Helper/DropHandler.cpp:126–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void DropHandler::HandleLeftClickDrop(IDataObject *pDataObject,POINTL *pptl)
127{
128 FORMATETC ftc;
129 STGMEDIUM stg;
130 DWORD *pdwEffect = NULL;
131 DWORD dwEffect = DROPEFFECT_NONE;
132 BOOL bPrefferedEffect = FALSE;
133 POINT pt;
134
135 pt.x = pptl->x;
136 pt.y = pptl->y;
137
138 SetFORMATETC(&ftc,(CLIPFORMAT)RegisterClipboardFormat(CFSTR_PREFERREDDROPEFFECT),
139 NULL,DVASPECT_CONTENT,-1,TYMED_HGLOBAL);
140
141 /* Check if the data has a preferred drop effect
142 (i.e. copy or move). */
143 HRESULT hr = pDataObject->GetData(&ftc,&stg);
144
145 if(hr == S_OK)
146 {
147 pdwEffect = (DWORD *)GlobalLock(stg.hGlobal);
148
149 if(pdwEffect != NULL)
150 {
151 if(*pdwEffect != DROPEFFECT_NONE)
152 {
153 dwEffect = *pdwEffect;
154 bPrefferedEffect = TRUE;
155 }
156
157 GlobalUnlock(stg.hGlobal);
158 }
159
160 ReleaseStgMedium(&stg);
161 }
162
163 HRESULT hrCopy = E_FAIL;
164 std::list<std::wstring> pastedFileList;
165
166 if(CheckDropFormatSupported(pDataObject,&m_ftcHDrop))
167 {
168 /* CopyHDropData may copy the data
169 in a background thread, so it
170 notifies the caller itself (rather
171 than returning a list of files
172 in PastedFileList). */
173 LOG(debug) << _T("Helper - Copying CF_HDROP data");
174 hrCopy = CopyHDropData(pDataObject,bPrefferedEffect,dwEffect);
175 }
176 else if(CheckDropFormatSupported(pDataObject,&m_ftcShellIDList))
177 {
178 LOG(debug) << _T("Helper - Copying CFSTR_SHELLIDLIST data");
179 hrCopy = CopyShellIDListData(pDataObject,pastedFileList);
180 }
181 else if(CheckDropFormatSupported(pDataObject,&m_ftcFileDescriptorA))
182 {
183 LOG(debug) << _T("Helper - Copying CFSTR_FILEDESCRIPTORA data");

Callers

nothing calls this directly

Calls 4

SetFORMATETCFunction · 0.85
GetDataMethod · 0.80
emptyMethod · 0.45
OnDropFileMethod · 0.45

Tested by

no test coverage detected