|
송진규 님이 쓰신 글 :
: 왕 초보입니다. 너무 쉬운 질문 드려서 죄송합니다.
:
: 탐색기로부터 drag&drop 받은 화일 리스트를 알고 싶습니다.
:
: 어떻게 해야 하는 지요?
:
: 폼 전체를 drop 할 수 있게 하려면 어떻게 설정해 주어야 하나요?
class TForm1 : public TForm
{
__published: // IDE-managed Components
TMemo *Memo1;
private: // User declarations
void __fastcall WMDropFiles(TWMDropFiles &message);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_DROPFILES,TWMDropFiles,WMDropFiles)
END_MESSAGE_MAP(TForm);
};
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
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);
}
|