Can not drag URLs from Internet Explorer and Drop them onto a UserForm

Started by LieseLover, January 30, 2009, 08:11:50 AM

Previous topic - Next topic

LieseLover

Hi folks,
I'd like to drag URLs from Internet Explorer and Drop them onto my UserForm
and finaly save them as a "*.url" file to use as bookmark in the Browser.

The procedure should be a part of a portable BookmarkManager which changes
temporary the Bookmarksfolder from usally "C:\Dokuments and Settings\USER\Favorites"
to the Location where the Bookmarks of the USB-Stick are.

So first I set the Style of my DialogBox on "WM_ACCEPTFILES" but this made the Win only accept
Files and Folders etc. not Links/Urls from a Browser.

After Googling for solutions I found an Example that came my wishes the nearest.
I modiefied it that when you drag a url from a Browser over the Form a messagebox appears holding
the URL.
But this is not a clean solution there should be a smarter Way with the typical Dragging Icon
and the Drop event.

As atachment for this Post there are 2 Files first A Flashdemo of what my Goal is
and second the Project file I modified.

Is someone here able to help me?

sry for my bad English

[attachment deleted by admin]

ToutEnMasm

Hello,
Your application need to implement OLE and perhaps used a control who accept this feature.A richedit control for example.




jj2007

Quote from: ToutEnMasm on January 30, 2009, 08:41:26 AM
Hello,
Your application need to implement OLE and perhaps used a control who accept this feature.A richedit control for example.

COM is not needed. A RichEdit control pastes the URL directly into the text.

LieseLover

Thx for yor reply.
It wasn't my aim to solve the Problem with an RichEdit I'd just like to drag the link on my
form and receive the Url when dropping it.

Greetz

donkey

Quote from: LieseLover on January 30, 2009, 09:45:56 PM
Thx for yor reply.
It wasn't my aim to solve the Problem with an RichEdit I'd just like to drag the link on my
form and receive the Url when dropping it.

Greetz

A URL is not really an object in the Shell namespace and therefore drag and drop using the shell api will not work with it. You will probably have to implement the IDropTarget interface and call RegisterDragDrop function with the handle of your window and an IDropTarget interface pointer. Once you have detected a drop, you will have to use the IDataObject interface to extract any information you need about the data. Interesting project, I might take a look at it this weekend if I finish up with the IVSHelp80 interface I am working on.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

jj2007

Quote from: LieseLover on January 30, 2009, 09:45:56 PM
Thx for yor reply.
It wasn't my aim to solve the Problem with an RichEdit I'd just like to drag the link on my
form and receive the Url when dropping it.

Greetz

Keep up the good spirit :thumbu
Why choose a simple solution (see attachment) if you can have fun with COM?

[attachment deleted by admin]

ToutEnMasm


After a little search , i found the more simple soluce
A richedit control have a EM_AUTOURLDETECT message who made the url text acting as an url and appear as an url.
Use a sample richedit control (there is one in the masm32 package without bug) and test this.


jj2007

Quote from: ToutEnMasm on January 31, 2009, 07:00:58 AM

After a little search , i found the more simple soluce
A richedit control have a EM_AUTOURLDETECT message who made the url text acting as an url and appear as an url.
Use a sample richedit control (there is one in the masm32 package without bug) and test this.

Just add the bold line to the source posted above:
      mov hEdit, eax                     ; we have created a RichEdit control
      sm hEdit, EM_AUTOURLDETECT, 1, 0
However, I don't think it will solve the problem. What he needs is not a richedit control that generates an EN_LINK notification. He simply wants to get the URL. For doing that, you need to capture EN_CHANGE in the WM_COMMAND handler, grab the URL with WM_GETTEXT and clear the control. Very simple, but still, why waste time with simple solutions if you can spend a weekend with COM? :bg

LieseLover

Quote from: jj2007 on January 31, 2009, 08:34:57 AM
..., but still, why waste time with simple solutions if you can spend a weekend with COM? :bg
Man I got the feeling you don't take me seriously  :lol but an RichEdit doesn't look good in a TrayBarIcon for example  :tdown

I simply want to get a handle for the Proc IDropTarget_Drop (see source)
In the Proc IDropTarget_DragEnter the Drag is recogniced by the Application and the Url (what is dragged) is also known but the
window doesen't accept that kind of Source showing the false cursor.
So in my opinion it's nessersary to change the GUID or something is that possible?

Greetz and thanks for helping

jj2007

Quote from: LieseLover on January 31, 2009, 09:02:10 AM
Quote from: jj2007 on January 31, 2009, 08:34:57 AM
..., but still, why waste time with simple solutions if you can spend a weekend with COM? :bg
Man I got the feeling you don't take me seriously  :lol but an RichEdit doesn't look good in a TrayBarIcon for example  :tdown

Yep that's right. Don't know if it would work with a TrayBarIcon... :dazzled:
Attached an advanced version of the UrlDropper.

[attachment deleted by admin]

ToutEnMasm


To jj2007,
Your sample need a debugger,He crash on a drag drop of a link.

ToutEnMasm



Quote
Man I got the feeling you don't take me seriously   but an RichEdit doesn't look good in a TrayBarIcon for example 

Seems here there is too many people needing help and laughing when someone try to help them.

I have no need of help and leave this post










jj2007

Quote from: ToutEnMasm on January 31, 2009, 01:27:28 PM

To jj2007,
Your sample need a debugger,He crash on a drag drop of a link.


Works perfectly for me, on Win XP SP2. Which OS are you using? Others having the same problem??

ToutEnMasm


jj2007

Quote from: ToutEnMasm on January 31, 2009, 05:15:35 PM

XP SP3 ,the two samples crash.


Immediately? Does the dialog show? Crash only when dropping the URL? I am getting curious...