Click here to Skip to main content
15,919,423 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCOM Events: reference values Pin
peterchen15-Mar-05 1:48
peterchen15-Mar-05 1:48 
GeneralBSTR TO STRING Pin
sunit515-Mar-05 1:45
sunit515-Mar-05 1:45 
GeneralRe: BSTR TO STRING Pin
ThatsAlok15-Mar-05 2:14
ThatsAlok15-Mar-05 2:14 
GeneralRe: BSTR TO STRING Pin
sunit515-Mar-05 2:41
sunit515-Mar-05 2:41 
GeneralRe: BSTR TO STRING Pin
ThatsAlok15-Mar-05 2:59
ThatsAlok15-Mar-05 2:59 
GeneralRe: BSTR TO STRING Pin
Ravi Bhavnani15-Mar-05 3:34
professionalRavi Bhavnani15-Mar-05 3:34 
GeneralRe: BSTR TO STRING Pin
includeh1015-Mar-05 8:25
includeh1015-Mar-05 8:25 
GeneralProblem in Copying a data / image to a ClipBoard Pin
zahid_ash15-Mar-05 1:44
zahid_ash15-Mar-05 1:44 
I am using the Following code :
When i call it first time to copy data , then i paste it in any MS word or Excel it works , On Second time when i copy the data the Program Crashes At the statment :
/////pData->SetClipboard();

CopyData()
{
CDC* dcRef = GetDC();

tagSTGMEDIUM * data;
data = new tagSTGMEDIUM;


CMetaFileDC * dcMeta;
dcMeta = new CMetaFileDC();
if(!dcMeta)
{
AfxMessageBox("Unable to Load data on Clipboard");
return;
}

COleDataSource* pData = new COleDataSource;

//replace "ImageName" with a description of this image
dcMeta->CreateEnhanced(dcRef, NULL, NULL,"Cca-Graph" );
dcMeta->SetMapMode(MM_TEXT);


dcMeta->SetAttribDC(dcRef->m_hAttribDC);

//actually draw to the device context
CRect rcWnd;
GetClientRect(&rcWnd);
//draw meta file :: do what ever you want to do: bitmaps, lines, text...
DrawChart(dcMeta, rcWnd, false);
//done drawing

data->tymed = TYMED_ENHMF;
data->hEnhMetaFile = dcMeta->CloseEnhanced();

pData->CacheData( CF_ENHMETAFILE, data );

////////////// Crashes Here when called Second time //////////////////////
pData->SetClipboard();

// Release the meta file attributes
dcMeta->ReleaseAttribDC();

delete dcMeta;
delete data;
}


Regards.
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
David Crow15-Mar-05 2:33
David Crow15-Mar-05 2:33 
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
zahid_ash15-Mar-05 2:49
zahid_ash15-Mar-05 2:49 
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
David Crow15-Mar-05 2:58
David Crow15-Mar-05 2:58 
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
zahid_ash15-Mar-05 3:06
zahid_ash15-Mar-05 3:06 
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
David Crow15-Mar-05 3:29
David Crow15-Mar-05 3:29 
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
zahid_ash15-Mar-05 18:28
zahid_ash15-Mar-05 18:28 
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
David Crow16-Mar-05 2:47
David Crow16-Mar-05 2:47 
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
zahid_ash16-Mar-05 2:57
zahid_ash16-Mar-05 2:57 
GeneralRe: Problem in Copying a data / image to a ClipBoard Pin
David Crow16-Mar-05 3:44
David Crow16-Mar-05 3:44 
GeneralRemoving Tool Settings Pin
Franz Klein15-Mar-05 1:02
Franz Klein15-Mar-05 1:02 
GeneralHooking Pin
Veera Raghavendra15-Mar-05 0:33
Veera Raghavendra15-Mar-05 0:33 
GeneralRe: Hooking Pin
caykahve15-Mar-05 2:20
caykahve15-Mar-05 2:20 
Generalwindows media format sdk 9 problem Pin
dafengche14-Mar-05 23:49
dafengche14-Mar-05 23:49 
GeneralError i don't need! Pin
Larsson14-Mar-05 23:21
Larsson14-Mar-05 23:21 
GeneralRe: Error i don't need! Pin
Anonymous14-Mar-05 23:27
Anonymous14-Mar-05 23:27 
GeneralRe: Error i don't need! Pin
Larsson14-Mar-05 23:45
Larsson14-Mar-05 23:45 
GeneralRe: Error i don't need! Pin
Larsson15-Mar-05 0:10
Larsson15-Mar-05 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.