Solved

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

Posted on 2010-08-29
8
526 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 86

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 86

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 86

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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