Last active
November 1, 2017 06:35
-
-
Save z4none/63885a8d02467478a33e to your computer and use it in GitHub Desktop.
[Accept drop file] #BCB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // .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