Board index » cppbuilder » OLE drag-drop -- dropping on app icons to start app problem

OLE drag-drop -- dropping on app icons to start app problem

I am playing with OLE drag-drop.  At this
point, dropping a file, say from a treeview, onto
the desktop works.  The file is copied.  

However, when I drop onto an app's icon (on
the desktop), e.g., a ".cpp" file onto a shortcut
to BCB.EXE, nothing happens.  I would have expected
BCB to start up and open the dropped file in the
source code editor.  

What appears to be happening is that the format
passed into TDataObject::GetData() in the FORMATETC
parameter (formatetcIn) isn't "CF_HDROP" (15).  
But it's hard to tell what it will be --
formatetcIn.cfFormat seems to range from 52840 to
more than 53000.  There are no such values defined
in "winresrc.h".

What's the secret?

Paul Furbacher

 

Re:OLE drag-drop -- dropping on app icons to start app problem


In article <34B5DC81.3...@bilbo.bio.purdue.edu>, p...@bilbo.bio.purdue.edu
says...

Quote
>What appears to be happening is that the format
>passed into TDataObject::GetData() in the FORMATETC
>parameter (formatetcIn) isn't "CF_HDROP" (15).  
>But it's hard to tell what it will be --
>formatetcIn.cfFormat seems to range from 52840 to
>more than 53000.  There are no such values defined
>in "winresrc.h".

I've played with drag and drop before.  I'm not sure what the exact
problem is, but I suggest using the GetClipboardFormatName API function
to try and get a text description of the format in question.  Hopefully
this will be enough to figure out the problem.  The shell drag and drop
docs are a bit weak...

--
Chris Hill
hil...@cs.purdue.edu

Re:OLE drag-drop -- dropping on app icons to start app problem


Quote
Chris Hill wrote:

> In article <34B5DC81.3...@bilbo.bio.purdue.edu>, p...@bilbo.bio.purdue.edu
> says...
> >What appears to be happening is that the format
> >passed into TDataObject::GetData() in the FORMATETC
> >parameter (formatetcIn) isn't "CF_HDROP" (15).
> >But it's hard to tell what it will be --
> >formatetcIn.cfFormat seems to range from 52840 to
> >more than 53000.  There are no such values defined
> >in "winresrc.h".

> I've played with drag and drop before.  I'm not sure what the exact
> problem is, but I suggest using the GetClipboardFormatName API function
> to try and get a text description of the format in question.  Hopefully
> this will be enough to figure out the problem.  The shell drag and drop
> docs are a bit weak...

GetClipboardFormatName(formatetcIn, ...) returns "Shell ID List".
So, the question is how do I create the shell id list properly?
If I have a single filename (fully qualified), would it make
sense to use IShellFolder::ParseDisplayName() which fills in
an LPITEMIDLIST *ppidl when given an OLESTR version of the
filename?  (I'm just flailing away here, actually.)

Any ideas or explanations would be appreciated.

Thanks.

Paul Furbacher

Re:OLE drag-drop -- dropping on app icons to start app problem


In article <34B73D79.4...@bilbo.bio.purdue.edu>, p...@bilbo.bio.purdue.edu
says...

Quote
>GetClipboardFormatName(formatetcIn, ...) returns "Shell ID List".
>So, the question is how do I create the shell id list properly?
>If I have a single filename (fully qualified), would it make
>sense to use IShellFolder::ParseDisplayName() which fills in
>an LPITEMIDLIST *ppidl when given an OLESTR version of the
>filename?  (I'm just flailing away here, actually.)

>Any ideas or explanations would be appreciated.

I really haven't worked through all the details.  I would try the
procedure that you described.  Get the IShellFolder of the Desktop
using SHGetDesktopFolder, then call ParseDisplayName.  I'm not sure if
this will work or not.  It's not clear to me _WHERE_ you can
ParseDisplayName from.  I hope you don't need to walk a bunch of
IShellFolders...

I wish MS would have provided an inverse function for
SHGetPathFromIDList....  Then you wouldn't need to fool around with the
IShellFolder interface at all....

--
Chris Hill
hil...@cs.purdue.edu

Other Threads