Click here to Skip to main content
15,901,426 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: mysql.h not found Pin
eclairs_db3-Jul-07 3:28
eclairs_db3-Jul-07 3:28 
QuestionCPropertyPage and default button behavior Pin
tabor252-Jul-07 20:50
tabor252-Jul-07 20:50 
AnswerRe: CPropertyPage and default button behavior Pin
Iain Clarke, Warrior Programmer3-Jul-07 6:18
Iain Clarke, Warrior Programmer3-Jul-07 6:18 
QuestionWindows Media Player ActiveX Control. Pin
adityarao312-Jul-07 20:24
adityarao312-Jul-07 20:24 
Questionis it posible to do this.... Pin
Jhony george2-Jul-07 20:04
Jhony george2-Jul-07 20:04 
QuestionRe: is it posible to do this.... Pin
Hamid_RT2-Jul-07 22:15
Hamid_RT2-Jul-07 22:15 
QuestionRe: is it posible to do this.... Pin
Jhony george2-Jul-07 22:55
Jhony george2-Jul-07 22:55 
AnswerRe: is it posible to do this.... [modified] Pin
Mark Salsbery3-Jul-07 10:11
Mark Salsbery3-Jul-07 10:11 
You could use COleDropTarget, something like:
// Make sure you've called OleInitialize()
...
//----------------------------------------------------------------------------------------
// Add/implement a COleDropTarget-derived class
class CMyTreeCtrlDropTarget : public COleDropTarget
{
protected:
   virtual DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
 
   virtual BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
  
public:
};
 
DROPEFFECT CMyTreeCtrlDropTarget::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
{
   if (pDataObject->IsDataAvailable(CF_HDROP, NULL))
   {
      <code>// Use the passed point to hittest on the treeview control to select the appropriate item</code>
 
      return DROPEFFECT_COPY;
   }
 
   return DROPEFFECT_NONE;
}
 
BOOL CMyTreeCtrlDropTarget::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
{
   if (pDataObject->IsDataAvailable(CF_HDROP, NULL))
   {
      STGMEDIUM StgMedium;
      pDataObject->GetData(CF_HDROP, &StgMedium, NULL);
      DROPFILES *pDropFiles = (DROPFILES *)::GlobalLock(StgMedium.hGlobal);
      TCHAR *pFileNames = (TCHAR *)((BYTE *)pDropFiles + pDropFiles->pFiles);
      //
      <code>// do something with file pathname(s) here</code>
      //
      ::GlobalUnlock(StgMedium.hGlobal);
   }
 
   return FALSE;//COleDropTarget::OnDrop(pWnd, pDataObject, dropEffect, point);
}
...
//----------------------------------------------------------------------------------------
// Add a member variable somewhere to hold a CMyTreeCtrlDropTarget object
CMyTreeCtrlDropTarget MyTreeCtrlDropTarget;
...
//----------------------------------------------------------------------------------------
// When the treeview control is created (its HWND is valid) then register the control with the drop target
MyTreeCtrlDropTarget.Register(pTreeCtrl);

Note this is a simple example. I haven't implemented the hittesting in
CMyTreeCtrlDropTarget::OnDragOver(). You may also want to return DROPEFFECT_NONE if the drop
target point isn't apropriate.

Hope this helps,
Mark


Mark Salsbery
Microsoft MVP - Visual C++


"Go that way, really fast. If something gets in your way, turn."

GeneralRe: is it posible to do this.... Pin
Jhony george3-Jul-07 21:47
Jhony george3-Jul-07 21:47 
GeneralRe: is it posible to do this.... Pin
Mark Salsbery4-Jul-07 6:09
Mark Salsbery4-Jul-07 6:09 
QuestionA simple problem about DrawText Pin
whiteclouds2-Jul-07 17:09
whiteclouds2-Jul-07 17:09 
AnswerRe: A simple problem about DrawText Pin
Arman S.2-Jul-07 19:27
Arman S.2-Jul-07 19:27 
Questionproblem about RichEdit Pin
kcynic2-Jul-07 15:29
kcynic2-Jul-07 15:29 
AnswerRe: problem about RichEdit Pin
Naveen2-Jul-07 15:42
Naveen2-Jul-07 15:42 
GeneralRe: problem about RichEdit Pin
kcynic2-Jul-07 18:41
kcynic2-Jul-07 18:41 
QuestionKeywords that I don't understand Pin
Alex Cutovoi2-Jul-07 13:26
Alex Cutovoi2-Jul-07 13:26 
AnswerRe: Keywords that I don't understand Pin
Stephen Hewitt2-Jul-07 13:30
Stephen Hewitt2-Jul-07 13:30 
AnswerRe: Keywords that I don't understand [modified] Pin
Jeremy Falcon2-Jul-07 14:12
professionalJeremy Falcon2-Jul-07 14:12 
GeneralRe: Keywords that I don't understand Pin
Stephen Hewitt2-Jul-07 15:03
Stephen Hewitt2-Jul-07 15:03 
GeneralRe: Keywords that I don't understand Pin
Jeremy Falcon2-Jul-07 15:16
professionalJeremy Falcon2-Jul-07 15:16 
GeneralRe: Keywords that I don't understand Pin
Stephen Hewitt2-Jul-07 15:38
Stephen Hewitt2-Jul-07 15:38 
GeneralRe: Keywords that I don't understand Pin
Jeremy Falcon2-Jul-07 16:00
professionalJeremy Falcon2-Jul-07 16:00 
GeneralRe: Keywords that I don't understand Pin
Stephen Hewitt2-Jul-07 16:15
Stephen Hewitt2-Jul-07 16:15 
GeneralRe: Keywords that I don't understand Pin
Jeremy Falcon2-Jul-07 16:24
professionalJeremy Falcon2-Jul-07 16:24 
GeneralRe: Keywords that I don't understand Pin
Jeremy Falcon2-Jul-07 16:08
professionalJeremy Falcon2-Jul-07 16:08 

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.