std::list<string> m_listFileNames;STDMETHODIMP CJexContextMenu::Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT lpdobj, HKEY hkeyProgID)
{
HRESULT hres = E_FAIL;
FORMATETC fmte = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
STGMEDIUM medium;
int nFileCount = 0, i;
_TCHAR strFilePath[MAX_PATH]; // No data object
if (lpdobj == NULL)
return E_FAIL; // Use the given IDataObject to get a list of filenames (CF_HDROP).
hres = lpdobj->GetData(&fmte, &medium); if (FAILED(hres))
return E_FAIL; // Make sure HDROP contains at least one file.
if ((nFileCount = DragQueryFile((HDROP)medium.hGlobal, (UINT)(-1), NULL, 0)) >= 1)
{
// Loop through all the files that were selected.
for (i = 0; i < nFileCount; i++) 
{
DragQueryFile((HDROP)medium.hGlobal, i, strFilePath, MAX_PATH);
// If the file name is a directory, make sure it has a backslash at the end.
if (::GetFileAttributes(strFilePath) & FILE_ATTRIBUTE_DIRECTORY) 
{
int nLen = _tcslen(strFilePath);
if (strFilePath[nLen-1] != _T('\\')) 
{
_tcscat(strFilePath, _T("\\"));
}
}
// Add the file name to the end of the list.
m_listFileNames.push_back(strFilePath);
}
hres = S_OK;
}
else
hres = E_FAIL; // Release the data.
ReleaseStgMedium (&medium); return hres;
}STDMETHODIMP CJexContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
{
_TCHAR* pStrClipboardText = NULL, strTempFileNameBuff[MAX_PATH + 50];
_TCHAR *pCurrent = NULL, *pLast = NULL;
BOOLEAN bMakeCStyleString = ((GetKeyState(VK_CONTROL) & 0x8000) != 0);
BOOLEAN bMakeShortPath = ((GetKeyState(VK_SHIFT) & 0x8000) != 0);
int nFileCount = 0, i;
CString strPath;  if (!HIWORD(lpici->lpVerb)) 
{
UINT nCmd = LOWORD(lpici->lpVerb);
CString strFilePath = m_listFileNames.front().data();
AfxMessageBox(strFilePath);
break;
    }
    return S_OK;
}