On Fri, Dec 2, 2011 at 3:33 PM, Kohei Yoshida <[email protected]> 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;
}
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice