Click here to Skip to main content
       

C / C++ / MFC

 
GeneralRe: Pop up window from a dialog based application PinmvpRichard MacCutchan6-Feb-13 23:43 
GeneralRe: Pop up window from a dialog based application PinmemberMember 80516117-Feb-13 0:29 
GeneralRe: Pop up window from a dialog based application PinmvpRichard MacCutchan7-Feb-13 0:50 
GeneralRe: Pop up window from a dialog based application PinmemberMember 805161111-Feb-13 19:55 
GeneralRe: Pop up window from a dialog based application PinmemberMember 80516115-Feb-13 19:33 
AnswerRe: Pop up window from a dialog based application PinmemberAlbert Holguin4-Feb-13 12:18 
QuestionHow to Implement Drag & Drop feature for Imagesin MFC.? Pinmembermbatra313-Feb-13 19:17 
AnswerRe: How to Implement Drag & Drop feature for Imagesin MFC.? PinmemberJochen Arndt3-Feb-13 21:46 
Handle the drag event in your dialog or the list. If your list is CListCtrl based use a LVN_BEGINDRAG handler. Otherwise use a WM_LBUTTONDOWN handler. From within that handler create a copy of the bitmap, cache it using the COleDataSource class and start the drag and drop operation:
 
CBitmap Bitmap;
// Get selected image into Bitmap here
COleDataSource DataSrc;
STGMEDIUM stgm;
stgm.tymed = TYMED_GDI;
stgm.hBitmap = static_cast<HBITMAP>(Bitmap.Detach());
stgm.pUnkForRelease = NULL;
DataSrc.CacheData(CF_BITMAP, &stgm);
// When moving is allowed pass DROPEFFECT_COPY | DROPEFFECT_MOVE
//  here and delete the image when DoDragDrop returns DROPEFFECT_MOVE.
DataSrc.DoDragDrop(DROPEFFECT_COPY);
// Don't call default handler here when DoDragDrop has been called.
// Because OLE has handled all further mouse actions.
 
On the target side, use the COleDropTarget class. If the target is a CView derived class, it is simple to implement by adding a COleDropTarget member to the view, adding the virtual OnDrop... handlers and registering the view as drop target from OnInitialUpdate(). With other window types than CView based ones, you must derive your own window specific COleDropTarget class that knows your window class so that it can access the required functions and members.
 
From within the COleDropTarget::OnDrop[Ex] function, use the provided COleDataObject to get the data by calling GetData(CF_BITMAP, &stgm).
 
When using the MFC COle... classes, you must include afxole.h (e.g. in stdafx.h) and call AfxOleInit() from within InitInstance() of your Windows app class.
QuestionStuck in WaveInProc PinmemberAmbiguousName2-Feb-13 7:21 
AnswerRe: Stuck in WaveInProc PinmvpCPallini2-Feb-13 10:38 
AnswerRe: Stuck in WaveInProc PinmvpRichard MacCutchan2-Feb-13 21:26 
QuestionBitmap creation from a buffer recived Pinmembertoms from newdelhi1-Feb-13 0:03 
AnswerRe: Bitmap creation from a buffer recived PinmvpRichard MacCutchan1-Feb-13 0:40 
GeneralRe: Bitmap creation from a buffer recived Pinmembertoms from newdelhi1-Feb-13 0:56 
GeneralRe: Bitmap creation from a buffer recived PinmvpRichard MacCutchan1-Feb-13 1:01 
GeneralRe: Bitmap creation from a buffer recived Pinmembertoms from newdelhi1-Feb-13 1:18 
GeneralRe: Bitmap creation from a buffer recived PinmvpRichard MacCutchan1-Feb-13 1:35 
GeneralRe: Bitmap creation from a buffer recived Pinmembertoms from newdelhi1-Feb-13 1:46 
GeneralRe: Bitmap creation from a buffer recived PinmvpRichard MacCutchan1-Feb-13 2:35 
GeneralRe: Bitmap creation from a buffer recived Pinmemberjibesh1-Feb-13 8:03 
QuestionMFC and printing PinmemberArgonia31-Jan-13 5:43 
AnswerRe: MFC and printing Pinmembersujayg1-Feb-13 16:21 
QuestionMFC Smart Device App with Visual C++ in Visual Std 2008 Pinmembersefasolak31-Jan-13 3:09 
AnswerRe: MFC Smart Device App with Visual C++ in Visual Std 2008 PinmvpRichard MacCutchan31-Jan-13 3:45 
Questionunable to register COM dll 64 bit Pinmemberjohn563231-Jan-13 2:12 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 28 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid