Windows 7 Word 2010和Windows 7的复制和粘贴问题

Windows 7 Word 2010和Windows 7的复制和粘贴问题,windows-7,ms-word,clipboard,Windows 7,Ms Word,Clipboard,我有一个程序,可以通过剪贴板与MS Office应用程序交换数据 这在Office2007和WindowsVista/XP中运行良好,但在Office2010/Windows7中失败 IDataObject *d = NULL; HRESULT hr = ::OleGetClipboard(&d); if (hr == S_OK) { FORMATETC formatEtc; formatEtc.cfFormat = ::

我有一个程序,可以通过剪贴板与MS Office应用程序交换数据

这在Office2007和WindowsVista/XP中运行良好,但在Office2010/Windows7中失败

    IDataObject *d = NULL;
    HRESULT hr = ::OleGetClipboard(&d);
    if (hr == S_OK) 
    {
        FORMATETC formatEtc;
        formatEtc.cfFormat = ::RegisterClipboardFormat("Native");
        formatEtc.ptd = NULL;
        formatEtc.dwAspect = DVASPECT_CONTENT;
        formatEtc.lindex = -1;


        STGMEDIUM stgMedium;
        hr = d->QueryGetData(&formatEtc);
此调用后,返回一个错误-0x8004006a剪贴板格式无效

我试着在网上搜索,但没有找到任何相关信息。如有任何意见/建议,将不胜感激


谢谢。

我在Office 2007和Windows-server-2008中遇到了类似的问题,我想问题不在于Office,而在于Windows 7/2008。您是否将程序作为服务运行?还是作为可执行文件? 我还在这里等我的问题的答案:

请让我知道你是否已经解决了你的问题

更新:我发现这是一个会话问题。尝试查明您的应用程序和word/other office应用程序是否在同一会话中运行尝试使用process explorer进行此操作