Hi,

I am trying to implement OnEditCopy() for my application to copy a user defined data structure to clipboard with a user

defined registered clipboard format. The implementation is present in a DLL. Everything goes fine except the

SetClipBoard call with fails with exception code CLIPBRD_E_CANT_SET. The sequence of operation is as follows..

char *pData = GetUserDefinedData();

long len = GetDataLength();

memset((void *) &stg, 0, sizeof(STGMEDIUM));

stg.tymed = TYMED_HGLOBAL;

stg.hGlobal = GlobalAlloc(GMEM_SHARE, len);

memcpy((char *)stg.hGlobal, pData, len);

// put the stuff on the clipboard

COleDataSource *pSrc = new COleDataSource;

pSrc->CacheData(currentClipFormat, &stg);

pSrc->SetClipboard(); //This call fails


Can anybody help?????


Thanks