COleDataObject error
-
Hi All I am geting error when i am useing COleDataObject.I got some example code from net.It's very help full for me but when i am use the code then i am geting error.
COleDataObject odj1;
if( odj1.AttachClipboard() )
{
if( odj1.IsDataAvailable( CF_HDROP ) )
{
STGMEDIUM StgMed;
FORMATETC fmte = { CF_HDROP,
(DVTARGETDEVICE FAR *)NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL };
if( odj1.GetData( CF_HDROP, &StgMed, &fmte ) )
{
HDROP hDrop = (HDROP)StgMed.hGlobal;
UINT cFiles = ::DragQueryFile(hDrop, (UINT)-1, NULL, 0);
CString szText;
char szFile[MAX_PATH];
szText="";
for( UINT count = 0; count < cFiles; count++ )
{
::DragQueryFile(hDrop, count, szFile, sizeof(szFile));
szText += szFile;
szText += "\r\n";
}
m_pRich->ReplaceSel(szText);
if (StgMed.pUnkForRelease)
{
StgMed.pUnkForRelease->Release();
}
else
{
::GlobalFree(StgMed.hGlobal);
}
return;
}
}
}error geting
error C2079: 'odj1' uses undefined class 'COleDataObject'
error C2228: left of '.AttachClipboard' must have class/struct/union
error C2228: left of '.IsDataAvailable' must have class/struct/union
error C2228: left of '.GetData' must have class/struct/unionPlz help me
-
Hi All I am geting error when i am useing COleDataObject.I got some example code from net.It's very help full for me but when i am use the code then i am geting error.
COleDataObject odj1;
if( odj1.AttachClipboard() )
{
if( odj1.IsDataAvailable( CF_HDROP ) )
{
STGMEDIUM StgMed;
FORMATETC fmte = { CF_HDROP,
(DVTARGETDEVICE FAR *)NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL };
if( odj1.GetData( CF_HDROP, &StgMed, &fmte ) )
{
HDROP hDrop = (HDROP)StgMed.hGlobal;
UINT cFiles = ::DragQueryFile(hDrop, (UINT)-1, NULL, 0);
CString szText;
char szFile[MAX_PATH];
szText="";
for( UINT count = 0; count < cFiles; count++ )
{
::DragQueryFile(hDrop, count, szFile, sizeof(szFile));
szText += szFile;
szText += "\r\n";
}
m_pRich->ReplaceSel(szText);
if (StgMed.pUnkForRelease)
{
StgMed.pUnkForRelease->Release();
}
else
{
::GlobalFree(StgMed.hGlobal);
}
return;
}
}
}error geting
error C2079: 'odj1' uses undefined class 'COleDataObject'
error C2228: left of '.AttachClipboard' must have class/struct/union
error C2228: left of '.IsDataAvailable' must have class/struct/union
error C2228: left of '.GetData' must have class/struct/unionPlz help me
Did you include afxole.h as stated in the documentation[^] ?
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++