1
WI有一個Windows外殼擴展,它在右鍵單擊打印機時將菜單項添加到打印機菜單。該代碼在Windows 2000,XP,Vista中正常工作,但在Windows 7中,對GetData()的調用會因DV_E_FORMATETC失敗。我已經找到關於這個的各種線程,但他們都似乎是VB/ASP相關。該FORMATETC和STGMEDIUM結構初始化如下當請求CFSTR_PRINTERGROUP時出現錯誤DV_E_FORMATETC - Windows 7
STGMEDIUM medium = {TYMED_HGLOBAL, {0}, 0};
FORMATETC fmte = {(unsigned short)RegisterClipboardFormat(CFSTR_PRINTERGROUP),
NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL};
<snip>
hrc = pDataObj->GetData(&fmte, &medium);
if (FAILED(hrc))
{
hrc is DV_E_FORMATETC