Solved

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

Posted on 2010-08-29
8
508 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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 27

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

777 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