Skip to content

Instantly share code, notes, and snippets.

@z4none
Last active November 1, 2017 06:35
Show Gist options
  • Select an option

  • Save z4none/63885a8d02467478a33e to your computer and use it in GitHub Desktop.

Select an option

Save z4none/63885a8d02467478a33e to your computer and use it in GitHub Desktop.
[Accept drop file] #BCB
// .h
void __fastcall AcceptFiles (TMessage& Msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_DROPFILES, TMessage, AcceptFiles)
END_MESSAGE_MAP(TForm)
// .cpp
__fastcall TFormMain::TFormMain(TComponent* Owner)
: TForm(Owner)
{
DragAcceptFiles(Handle, true);
}
//
void __fastcall TFormMain::AcceptFiles(TMessage& Msg)
{
char path[MAX_PATH];
// int count = DragQueryFile((HANDLE)Msg.WParam, 0xffffffff, path , MAX_PATH);
DragQueryFile((HANDLE )Msg.WParam, 0, path , MAX_PATH);
ShowMessage(path);
DragFinish ((HANDLE)Msg.WParam);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment