|
저 그러면 제가 원하는 ListView에 탐색기를 드랍시 이벤트를 발생하게 하려면 어떻게 해야 하나요 ???
장성호 님이 쓰신 글 :
: "탐색기에서 드래그 하고 놓는 순간 이벤트가 감지 되어야 하는데..."
:
:
: WM_DROPFILES 메세지는 탐색기에서 드래그 하고자 하는 순간 발생하는 메세지가 아닙니다.
:
: Drag해서 Window(Form)에 Drop시켰을때 발생하는 메세지입니다.
:
: 그리고 Window(Form)가 탐색기로 부터 Drag-Drop 허용하기 위해서는
: DragAcceptFiles를 해주어야 합니다.
:
: DragAcceptFiles(Handle,true)
:
: 그럼..
:
:
: 거짓말처럼 님이 쓰신 글 :
: :
: :
: : #include <vector>
: :
: : using namespace std;
: :
: : class TForm1 : public TForm
: : {
: : __published: // IDE-managed Components
: :
: : void __fastcall WMDropFiles(TWMDropFiles &Msg);
: : void __fastcall FormCreate(TObject *Sender);
: :
: :
: : private: // User declarations
: : public: // User declarations
: : __fastcall TForm1(TComponent* Owner);
: :
: :
: : BEGIN_MESSAGE_MAP
: : VCL_MESSAGE_HANDLER(WM_DROPFILES, TWMDropFiles, WMDropFiles);
: : END_MESSAGE_MAP(TForm)
: : };
: :
: :
: : //---------------------------------------------------------------------------
: : extern PACKAGE TForm1 *Form1;
: : //---------------------------------------------------------------------------
: : #endif
: :
: :
: : void __fastcall TForm1::FormCreate(TObject *Sender)
: : {
: : DragAcceptFiles(Handle, true);
: : }
: :
: : void __fastcall TForm1::WMDropFiles(TWMDropFiles &message)
: : {
: : char fullPath[MAX_PATH];
: : UINT fileCount = DragQueryFile((HDROP)message.Drop,0xffffffff,NULL,0);
: : for(UINT i=0 ;i<fileCount ;i++)
: : {
: : DragQueryFile((HDROP)message.Drop,i,fullPath,MAX_PATH);
: : // Memo1->Lines->Add(fullPath);
: : }
: : DragFinish((HDROP)message.Drop);
: : }
: :
: : //---------------------------------------------------------------------------
: :
: : 위 코드와 같이 BEGIN_MESSAGE_MAP 을 이용하면 탐색기에서 드래그 하고 놓는 순간 이벤트가 감지 되어야 하는데
: :
: : WMDropFiles함수에 디버깅을 위하여 브레이크를 걸어도 함수 호출 자체가 되지 않습니다...
|