Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Oren Halvani
Wed, 20 Sep 2006 01:15
How to accept Drag 'n Drop from Outlook Express or any other application besides the Explorer...?
Author: Oren Halvani
Date: Wed, 20 Sep 2006 01:15
Date: Wed, 20 Sep 2006 01:15
50 lines
2637 bytes
2637 bytes
dear builders,
can someone explain me what i should do if i want my programm to accept Drag 'n Drop
from Outlook Express (for instance: E-Mails or News-posts) or any other application ?
The below function works pretty fine for Drag 'n Drop of files from the Windows Explorer,
but what about other applications ???
Do i need to catch the Drag 'n Drop message of each specific application via:
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_DROPFILES, TWMDropFiles, WMDropFiles);
END_MESSAGE_MAP(TForm)
I've noticed, Drag 'n Drop of text into my program works from the most applications
that use lke my program the RichEdit control...so why can't I do the same Drag 'n Drop
for other things like: E-Mails from Outlook Express or Thunderbird, etc... ?
Oren
/***********************************************************/
void __fastcall TfrmMainUnit::WMDropFiles(TWMDropFiles &Message)
{
int DropCount = DragQueryFile((HDROP)Message.Drop, -1, NULL, 0), StrLength;
char FileName[MAX_PATH];
for(int index = 0; index < DropCount; index++)
{
StrLength = DragQueryFile((HDROP)Message.Drop, index, NULL,0);
DragQueryFile((HDROP)Message.Drop, index, FileName, StrLength + 1);
if(FileGetAttr(FileName) & faDirectory) {AddFiles_Check(FileName);}
else
{
FileShow(FileName);
SaveRegFiles();
FileBox_Operations();
}
}
if(DropCount > 0)
{
FileBox->Selected[-1] = true;
cmdEditMode->Down = false;
if(frmMainUnit->Active && txtContains->Enabled) txtContains->SetFocus();
}
}
Re: How to accept Drag 'n Drop from Outlook Express or any other application besides the Explorer...?
Author: Remy Lebeau (TeamB)
Date: Wed, 20 Sep 2006 03:41
Date: Wed, 20 Sep 2006 03:41
38 lines
2511 bytes
2511 bytes
"Oren Halvani" <Spam@halvani.de> wrote in message news:45109658@newsgroups.borland.com... > can someone explain me what i should do if i want my programm > to accept Drag 'n Drop from Outlook Express (for instance: > E-Mails or News-posts) or any other application ? What you are asking for is VASTLY more complex to implement than what you were using before. You have to write a class that inherits from the IDropTarget interface, and then use RegiserDragDrop() to let the OS know about it. When another application wants to begin a Drag&Drop operation, it has to call DoDragDrop(). When an item is dragged over your application and then dropped, the variable methods of the IDropTarget interface will be called inside your application. You can then retrieve the data from the provided IDataObject interface. Please go to http://www.deja.com and search through the newsgroup archives. This topic has been discussed many times before. > Do i need to catch the Drag 'n Drop message of each specific application No, because there are no messages involved to begin with. > I've noticed, Drag 'n Drop of text into my program works from the > most applications that use lke my program the RichEdit control... That kind of Drag&Drop operation is handled by the RichEdit control itself at the OS layer. > why can't I do the same Drag 'n Drop for other things like: E-Mails > from Outlook Express or Thunderbird, etc... ? Because you are approaching the issue from the wrong direction. Such data requires a completely different approach, as described above. Gambit
Re: How to accept Drag 'n Drop from Outlook Express or any other application besides the Explorer...?
Author: Oren Halvani
Date: Wed, 20 Sep 2006 21:31
Date: Wed, 20 Sep 2006 21:31
31 lines
2073 bytes
2073 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schrieb im Newsbeitrag news:4510b9e4@newsgroups.borland.com... > What you are asking for is VASTLY more complex to implement than what you > were using before. You have to write a class that inherits from the > IDropTarget interface, and then use RegiserDragDrop() to let the OS know > about it. When another application wants to begin a Drag&Drop operation, it > has to call DoDragDrop(). When an item is dragged over your application and > then dropped, the variable methods of the IDropTarget interface will be > called inside your application. You can then retrieve the data from the > provided IDataObject interface. > No, because there are no messages involved to begin with. > > > Because you are approaching the issue from the wrong direction. Such data > requires a completely different approach, as described above. > > > Gambit thanks Remy, i thought it won't be so complicated...it's a really complex task :-) anyhow, thanks for the feedback :-) Oren
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads