Copy and paste problems with Word 2010 and Windows 7

0

I have a program which is able to exchange data with MS Office applications, via the clipboard.

This works fine in Office 2007 and Windows Vista/XP, but fails with Office 2010/Windows 7

    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);

Following this call, I am returned an error - 0x8004006a Invalid clipboard format

I have tried searching the web, but haven't found any relevant information. Any advice/suggestions would be gratefully received.

Thanks.

windows-7
ms-word
clipboard
asked on Stack Overflow Jan 15, 2010 by Alan Gorman

1 Answer

0

i have a similar issue in Office 2007 and Windows-server-2008, my guess the problem is not the office but rather the windows 7/2008. are you running your program as a service? or an as executable? I'm still waiting for an answer for my question over here: Clipboard Copy-Paste doesn't work in a service on Win Server 2008/Vista 64bit

please let me know if you have resolved your issue!

Update: i have found out that this is a sessions issue. try finding out if your app and the word/ other office app is running in the same session (try using process explorer for that).

answered on Stack Overflow Feb 8, 2010 by Itay Levin • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0