On Fri, Dec 2, 2011 at 3:33 PM, Kohei Yoshida <kohei.yoshida@suse.com> wrote:
As a test, I
wrote another quick program to retrieve the clipboard format info using
the IDataObject API,
And here is the code (attached) that I used to retrieve the clipboard
format info via IDataObject, in case someone is curious.
Kohei
#include <Windows.h>
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
IDataObject* pData = NULL;
HRESULT hr = OleGetClipboard(&pData);
if (hr != S_OK)
{
cout << "failed to get the clipboard data object instance." << endl;
return EXIT_FAILURE;
}
cout << "IDataObject = " << pData << endl;
pData->AddRef();
IEnumFORMATETC* pFormats = NULL;
if (pData->EnumFormatEtc(DATADIR_GET, &pFormats) != S_OK)
{
cout << "failed to get available format types." << endl;
return EXIT_FAILURE;
}
pFormats->AddRef();
pFormats->Reset();
FORMATETC fetc;
while (S_FALSE != pFormats->Next(1, &fetc, NULL))
{
cout << "format code: " << fetc.cfFormat << endl;
char name[100];
int len = GetClipboardFormatName(fetc.cfFormat, name, 100);
if (!len)
continue;
cout << "format name: " << name << endl;
}
pFormats->Release();
pData->Release();
return EXIT_SUCCESS;
}
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.