Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - File drag drop on webbrowser control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

File drag drop on webbrowser control

 Post Reply Post Reply
Author
Message
Alina View Drop Down
Newbie
Newbie
Avatar

Joined: 26 September 2008
Location: Romania
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alina Quote  Post ReplyReply Direct Link To This Post Topic: File drag drop on webbrowser control
    Posted: 26 September 2008 at 6:20am
   Hello,
   I have a form having a web browser control on it.    
   I want to get the file name(s) along with path(s) whenever some file is dragged and dropped on my web browser control. 
   I added in code Application.RegisterAsDropTarget = True.  After that, when a file is draged and dropped on my webbrowser , the webbrowser loads the file's content.  And the  DragDrop event is not fired.

   How can I achieve this functionality?

   Thanks in advance!
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 02 October 2008 at 2:54am

Hi,

Why don't you use the WB navigate_complete event ?

When you drag and drop a file on a WB the file is loaded in the WB (do you want this ?) and the navigate_complete event is fired.
 
So you can do something like this :
 
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    MsgBox "File loaded " & URL
End Sub

Hope this help.
Back to Top
Alina View Drop Down
Newbie
Newbie
Avatar

Joined: 26 September 2008
Location: Romania
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alina Quote  Post ReplyReply Direct Link To This Post Posted: 04 October 2008 at 10:03am
Hi,
Thank you for your reply.
It doesn't help me very much  because I don't want the file to load in the webbrowser. I want to get only  the file name along with path. My application is an instant messenger. I want to have the possibility to send a file to the person I'm talking to, just like Yahoo messenger does.

Any other idea?
Thanks!

Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 09 October 2008 at 4:24am
If you want you can cancel the navigation !
For this use the before navigate event :
 
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
    MsgBox "File to upload : " & URL
    Cancel = True
End Sub
 
You should write some conditions to cancel the navigation. If you don't do that your webbrowser will no navigate at all.
Back to Top
Alina View Drop Down
Newbie
Newbie
Avatar

Joined: 26 September 2008
Location: Romania
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alina Quote  Post ReplyReply Direct Link To This Post Posted: 09 October 2008 at 4:31am
It was so simple and I didn't see it!
Thank you!

Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 10 October 2008 at 5:16am
You're welcome
Back to Top
Pooja View Drop Down
Newbie
Newbie


Joined: 04 November 2008
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pooja Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2008 at 3:54am
hello all
 
I have a from having web browser control on it...
webBroswer control have the url : 

this.webBrowser1.Url = new System.Uri("http://localhost:1162/OCOTVWidgetTestPage.html", System.UriKind.Absolute);

But my problem is this that i am unable to drag drop the webBrowser Control..I also make true this property AllowWebBrowserDrop

this.webBrowser1.AllowWebBrowserDrop = true;

But still i am unable to do it..

and secondly i m unable to make transperent the back ground og webBrowser Control
Please help me what to do.
 
Thanks in advance
Pooja
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 05 November 2008 at 9:43am
Hi,
 
The background of a webbrowser can't be transparent because it's the background of the webpage.
 
You want to allow the drag and drop ON the webbrowser or OF the webbrowser ?
 
It's different, if you want to allow drag and drop of a file on the webbrowser just look at my answer on the top of this post. The drag and drop is controled by the webbrowser control, you don't have to write any code (except for interception).
 
Note : i'm working with VB6, not you i think...
 
Hope this help,
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.171 seconds.