views:

447

answers:

1

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.

A: 

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: http://stackoverflow.com/questions/2192318/clipboard-copy-paste-doesnt-work-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).

Itay Levin

related questions