Programming - cpueblo.com

빌더 - Drag & Drop 으로 긁어온 파일 리스트 가져오기


글쓴이 : 유광희 날짜 : 2002-08-14 (수) 14:45 조회 : 5643

1. 폼 클래스 헤더 안에 다음을 집어 넣는다

	void __fastcall OnDropFiles(TWMDropFiles &Msg);
	BEGIN_MESSAGE_MAP
		 VCL_MESSAGE_HANDLER(WM_DROPFILES, TWMDropFiles, OnDropFiles);
	END_MESSAGE_MAP(TForm)


2. FormCreate 시에 아래 추가
void __fastcall TfrmWannyCodeHTML::FormCreate(TObject *Sender)
{
	DragAcceptFiles(Handle, true);
}


3. 이제 활용해 보쟈~
void __fastcall TfrmWannyCodeHTML::OnDropFiles(TWMDropFiles &Msg)
{
	HANDLE hDrop = (HANDLE)Msg.Drop;
	String FilePath;
	FilePath.SetLength(MAX_PATH);

	int FileCount = DragQueryFile(hDrop, 0xFFFFFFFF, FilePath.c_str(), MAX_PATH);
	for(int i=0; iMessageBoxA(FilePath.c_str(), "Drag 한 파일명");
	}

	DragFinish(hDrop);
}