[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Drag and Drop VB --> Another Application

Posted on 2000-03-07
8
Medium Priority
?
317 Views
Last Modified: 2012-05-04
Hi, I am trying to set up my VB program to enable drag and drop to another application.  More specifically, I have in my VB program both a listbox and a treeview each of which have a list of files in them, with full paths.  I want to enable the user to drag one of these files to a program (in this case winamp) to allow them to play, or be added to the playlist, etc.  

Please keep in mind that I have no knowledge of drag and drop or how it works.  If you are going to suggest something, please include code for it.  In so far as I am asking for such a thurough description, I have set the point value accordingly high.  Thanks.  
0
Comment
Question by:musaka
[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 15

Expert Comment

by:ameba
ID: 2592583
I tried this, but it doesn't work. It is possible to accept files from other applications (e.g. from Explorer), but the opposite does not work. I think it's a bug.
0
 

Author Comment

by:musaka
ID: 2592626
Are you saying it cannot be done?  
0
 
LVL 15

Expert Comment

by:ameba
ID: 2592672
No, I am saying I cannot do it, see my question http://www.experts-exchange.com/Q_10294456.html
0
Independent Software Vendors: 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 14

Expert Comment

by:wsh2
ID: 2593189
If Winamp is the program you desire to port to.. the real quick solution would be to a Shell command..

dim strWinAmp as String
dim strMP3File as String
strWinAmp = "c:\pathname\WINAMP.EXE"
strMP3File = "c:\pathname\MY.MP3"
SHELL strWinAmp & " " & strMP3File


0
 
LVL 1

Accepted Solution

by:
Catouch earned 900 total points
ID: 2595362
I wrote something in the opposite direction --> drag something from e.g. explorer to a listbox in VB, maybe it can help you.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Purpose: To drag xls sheets from outside the manager into it. e.g.:             '
'         drag from the explorer into manager                                    '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub treeview_OLEDragDrop(Data As MSComCtlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim sMsg As String, i%

    For i% = 1 To Data.Files.Count
        sMsg = sMsg & vbLf & Data.Files(i%)
    Next i%
   
   

End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Purpose: To drag xls sheets from outside the manager into it. e.g.:             '
'         drag from the explorer into manager                                    '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub treeview_OLEDragOver(Data As MSComCtlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
    WksTree.DropHighlight = WksTree.HitTest(X, Y)
End Sub
0
 

Author Comment

by:musaka
ID: 2606822
Adjusted points to 300
0
 

Author Comment

by:musaka
ID: 2606823
As for teh comment regarding shell, I want to enable drag&drop so you could use any mp3 player you wish...not jus winamp...it was just an example

As for the code going in reverse...I've seen similar but I'm still not sure how the reverse is implemented.  Thanks though.


I'm gonna try to up the point to lure an answer...
0
 

Author Comment

by:musaka
ID: 2606882
Ok...actually your reverse code gave me an idea...and now since this is the topic of controversy...i'll post the code I got ot work so you can all use it

for a given listbox...I set OLEdragmode to automatic...and then implemented the following code

Private Sub List1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
    Data.Files.Clear
    Data.SetData , vbCFFiles
    Data.Files.add filename
End Sub


and it works...!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

656 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