Solved

How to drag drop in vb.net using ONLY windows API?

Posted on 2010-08-29
8
515 Views
Last Modified: 2012-05-10
Hi experts,

i would like to implement drag drop by only using windows API,
can anyone can help?

Thank you,

Kind Regards?
0
Comment
Question by:Dnx_7
8 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 33553941
?

What exactly do you mean by that?

...and how does the built-in drag/drop functionality not meet your needs?
0
 
LVL 2

Author Comment

by:Dnx_7
ID: 33554000
Hi idle mind,

because we need  to intercept a dragged item from an external application...
we used the built-in drag drop .net but cannot detect what is the object dragged...

it is possible because another enterprise did it in C++

and the dragged item react on a Windows explorer windows...

so our possibilities are :

- simulate the windows explorer (like getting the handle and associate the handle to a form or panel... but don't really know if it is possible...à
- use the windows api drag drop to get the lower level and check the dragged item to analyze the object...


Thanks for your help,

Kind Regards
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 33554266
What application is the source of the drag drop?  What happens in explorer when that item is dropped?
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 2

Author Comment

by:Dnx_7
ID: 33554402
The application is a specific application for broadcast systems...
when this application init a drag drop out of his environment, it only reacts in a windows explorer otherwise, nothing happens

we infer that if we simulate the explorer then we can do something with the dropped item...
or we guess that if we use the lowest level of the drag drop (windows api) then we can catch the dragged item and do things with this..
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 33554442
Did you try using the GetFormats() function in the DragEnter() event for you control?
http://msdn.microsoft.com/en-us/library/1745023c.aspx

    Private Sub Panel1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Panel1.DragEnter
        Dim formats() As String = e.Data.GetFormats

    End Sub

Or can you not get any drag/drop events to fire at all for your app when the source item is dragged over it?
0
 
LVL 8

Accepted Solution

by:
Gururaj Badam earned 250 total points
ID: 33556828
0
 
LVL 28

Assisted Solution

by:Ark
Ark earned 250 total points
ID: 33573824
>>when this application INIT a drag drop OUT of his environment, it only reacts in a windows explorer otherwise, nothing happens<<
Drag/Drop operations are DDE processes which are initialized by Shell, not any application. When you press left mouse button and move mouse ANYWHERE, shell creates drag object and inform underlined window that drag operations began. If application  that created window supports drag&drop (Explorer, for example or your VB app with AllowDrag=true) it fill Object data and data formats and tells shell about it (DoDragDrop). Shell store this info until you release mouse button and then inform windowunder cursor that Drop event occure (VB DragDrop event occure).
So, if drag/drop source/target is your application - you can use native VB. But as I understood, drag source is Explorer and drop target is another app, correct? Fortunately, Explorer place Drag object into clipboard when start draggin. So you need
1. Monitor mouse activity over target app drop window
2. When mouse enter window- query clipboard data and change it if necessary.
0
 
LVL 2

Author Closing Comment

by:Dnx_7
ID: 33930042
Not really the solution but good to know
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question