ok guys, here's my plea for help

I'm not interested in learning the whole COM/OLE/whatever thing, but I'd love to be able to implement full drag-drop capabilities in a program of mine
Let me explain:
a) I can drag files FROM the File Manager and drop them in my program (easly done processing WM_DROPFILES and DragQueryFile)
b) I'd like to DRAG files from my program (which has a list view explorer-like) and DROP them into the File Manager: specifically I'm interested only in getting the destination directory currently selected in the File Manager ... the rest of the processing would be done by my program

Is there an easy way to do this?
I couldn't find any asm source code that would show me how to do it ... and as I mentioned at the beginning I don't want to learn the whole COM subject just to get a directory name from the File Manager. If there is an easy work-around I'd be happy, otherwise I'll do without full drag-drop capabilities

In the hope some1 could spare me some precious time and knowledge ... cheers


Random
Posted on 2001-11-23 09:55:02 by random
OK guys, I'm not even sure what I'm doing, but anyway

I need to create a IDataObject and a IDataSource object

in C++ is something like

dataobj = new CDataObject;
dropsource = new CDropSource;

How the heck do I do this in ASM??

you see, with the IDataSource I can then coinvoke the DoDragDrop method ... and then I have no idea, but I'm moving one step at a time

ANY HELP WILL BE REALLY APPRECIATED

pleeeeeeeeeaaaaaaaaaaaassssssssssssseeeeeeeeeeeee

Random
Posted on 2001-11-26 15:07:30 by random
I asked the same question a couple of weeks ago, and didn't get any answers, so started to look myself. I haven't solved it yet, but what you need to implement are the following functions, which you must have in a vtable:

DataObject:

STDMETHODIMP DataObjectUnknownQueryInterface(LPUNKNOWN pu, REFIID iid, void FAR* FAR* ppv);
STDMETHODIMP_(ULONG) DataObjectUnknownAddRef(LPUNKNOWN pu);
STDMETHODIMP_(ULONG) DataObjectUnknownRelease(LPUNKNOWN pu);

IUnknownVtbl DataObjectUnknownVtbl = {
DataObjectUnknownQueryInterface,
DataObjectUnknownAddRef,
DataObjectUnknownRelease
};

STDMETHODIMP DataObjectQueryInterface(LPDATAOBJECT pda, REFIID iid, void FAR* FAR* ppv);
STDMETHODIMP_(ULONG) DataObjectAddRef(LPDATAOBJECT pda);
STDMETHODIMP_(ULONG) DataObjectRelease(LPDATAOBJECT pda);
STDMETHODIMP DataObjectGetData(LPDATAOBJECT pda, LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium);
STDMETHODIMP DataObjectGetDataHere(LPDATAOBJECT pda, LPFORMATETC pformatetc, LPSTGMEDIUM pmedium);
STDMETHODIMP DataObjectQueryGetData(LPDATAOBJECT pda, LPFORMATETC pformatetc);
STDMETHODIMP DataObjectGetCanonicalFormatEtc(LPDATAOBJECT pda, LPFORMATETC pformatectIn, LPFORMATETC pformatetcOut);
STDMETHODIMP DataObjectSetData(LPDATAOBJECT pda, LPFORMATETC pformatetc, LPSTGMEDIUM pmedium, BOOL fRelease);
STDMETHODIMP DataObjectEnumFormatEtc(LPDATAOBJECT pda, DWORD dwDirection, LPENUMFORMATETC __RPC_FAR *ppenumFormatEtc);
STDMETHODIMP DataObjectDAdvise(LPDATAOBJECT pda, LPFORMATETC pformatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection);
STDMETHODIMP DataObjectDUnadvise(LPDATAOBJECT pda, DWORD dwConnection);
STDMETHODIMP DataObjectEnumDAdvise(LPDATAOBJECT pda, LPENUMSTATDATA __RPC_FAR *ppenumAdvise);

IDataObjectVtbl DataObjectVtbl = {
DataObjectQueryInterface,
DataObjectAddRef,
DataObjectRelease,
DataObjectGetData,
DataObjectGetDataHere,
DataObjectQueryGetData,
DataObjectGetCanonicalFormatEtc,
DataObjectSetData,
DataObjectEnumFormatEtc,
DataObjectDAdvise,
DataObjectDUnadvise,
DataObjectEnumDAdvise
};

DropSource:

STDMETHODIMP DropSourceUnknownQueryInterface(LPUNKNOWN pu, REFIID iid, void FAR* FAR* ppv);
STDMETHODIMP_(ULONG) DropSourceUnknownAddRef(LPUNKNOWN pu);
STDMETHODIMP_(ULONG) DropSourceUnknownRelease(LPUNKNOWN pu);

IUnknownVtbl DropSourceUnknownVtbl = {
DropSourceUnknownQueryInterface,
DropSourceUnknownAddRef,
DropSourceUnknownRelease
};

STDMETHODIMP DropSourceQueryInterface(LPDROPSOURCE pds, REFIID iid, void FAR* FAR* ppv);
STDMETHODIMP_(ULONG) DropSourceAddRef(LPDROPSOURCE pds);
STDMETHODIMP_(ULONG) DropSourceRelease(LPDROPSOURCE pds);
STDMETHODIMP DropSourceQueryContinueDrag(LPDROPSOURCE pds, BOOL fEscapePressed, DWORD grfKeyState);
STDMETHODIMP DropSourceGiveFeedback(LPDROPSOURCE pds, DWORD dwEffect);
HRESULT DropSourceCreate(IUnknown FAR* pUnknownOuter, REFIID iid, void FAR* FAR* ppv);

IDropSourceVtbl DropSourceVtbl = {
DropSourceQueryInterface,
DropSourceAddRef,
DropSourceRelease,
DropSourceQueryContinueDrag,
DropSourceGiveFeedback
};

Once you have them, I think all you then do is call the DoDragDrop function call, and it all works! Obviously it's much more complicated than that, but I haven't got it to work yet, so I'd be interested in any progress you make!

The code above are actally for a C type header file. Hope this is of some use to you.

Nick
Posted on 2001-11-27 07:00:11 by Nick
Nick.

yep. I've got that stuff. I've got C++ and C++/MFC (ugh!) source codes. It appears to be quite clear
Of course, what it's not clear is how to create the IDataObject and IDropSource objects in assembler and use them also in assembler. COM examples in MASM32 don't help much (and I really don't want to use VISUALBASIC!!!!!!!! to access my objects .. duh!!!)

But then again, I seriously started looking at COM/OLE Drag Drop yesterday, so I'm still at the bottom of the learning curve

Why don't you post what you've written till now and see if two brains are better than one ;)


cheers
Random
Posted on 2001-11-27 09:18:15 by random
Nick

I've done it and it works
I need to finish a couple of stuff and test it a little more, but I've already transferred my first file!
I'll post the source codes as soon as I can (although it might take a bit)

Random
Posted on 2001-11-29 03:01:26 by random
Random, that's great, all I'm getting at the moment on mine is, the invalid argument errors, when I actually call DoDragDrop. I've been trying to get it to work in C, mainly so I can use the Visual Studio debugger, which gives me a better idea about what's going on.

Look forward to seeing your code.

Nick
Posted on 2001-11-29 05:06:11 by Nick