1,221
社区成员
发帖
与我相关
我的任务
分享
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
// 使窗体接受拖放
::DragAcceptFiles(Handle, true);
}
private: // User declarations
void __fastcall WndProc(TMessage &Msg);
void __fastcall TForm1::WndProc(TMessage &Msg)
{
if (Msg.Msg == WM_DROPFILES)
{
TCHAR szFileName[MAX_PATH];
UINT uFileCount = ::DragQueryFile((HDROP)Msg.WParam, 0, szFileName, MAX_PATH);
::DragFinish((HDROP)Msg.WParam);
if (!uFileCount) return;
Caption = szFileName;
}
TForm::WndProc(Msg);
}