Galkin
I'm not using a text string anymore, but my FVInfo data structure instead. (IMAGEBARINFO FVInfo)
Is this code correct?
COleDataSource MyDataSource;
HGLOBAL hMyBlock = GlobalAlloc(GMEM_FIXED, sizeof (IMAGEBARINFO));
IMAGEBARINFO* pMyBlock = (IMAGEBARINFO*) GlobalLock(hMyBlock);
CopyMemory(pMyBlock,&FVInf
MyDataSource.CacheGlobalDa
MyDataSource.DoDragDrop(DR
GlobalUnlock(hMyBlock);
GlobalFree(hMyBlock);
Do I use the same code for normal copy/paste operations? If not, how is it different? (besides not calling dodragdrop)
Main Topics
Browse All Topics





by: galkinPosted on 1998-07-06 at 06:43:38ID: 1167241
I don't understand why you need to implement COleDropSource class. It wraps IDropInterface that allows you get feedback during drag and drop operation. You need to declare on stack where you want to implement drag and drop COleDataObject class instance. Then you need to create data object. Allocate memory block large enogh for your text data with GlobalAlloc. Lock it with GlobalLock. Copy text to allocated memory. Then call COleDataObject::CachGlobal Data passing handle to global memro you allocated and locked. Next step is call to COleDataObject::DoDragDrop . Last default parameter is pointer to COleDropSource class. you can derive you own class from COleDropSource and override its virtual functions which will be called during drag and drop. DoDragDrop enters modal loop until drop occurs or drag and drop operation is cancelled. ipboardFor mat
Finally you need to unlock and free memory with GlobalUnlock and GlobalFree. If you want to use your own format you need first to register it with COleDataObject::RegisterCl