|
-
May 19th, 2005, 12:16 PM
#1
Thread Starter
Need-a-life Member
Drag & Drop
Let's say I have a ListView with items in it, and I set it OLEDragMode to automatic. If I drag any of this items into a simple exe which code's is:
VB Code:
Option Explicit
Private Sub Form_Load()
MsgBox Command$
End
End Sub
I get no message at all. How do I get the dragged item to actually drop a command line on this exe... for starters.
The idea is to have the full path in the CommandLine and when it's dropped, the file would be copied into that location (Desktop, Folder, whatever)
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 21st, 2005, 11:08 PM
#2
Thread Starter
Need-a-life Member
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 22nd, 2005, 11:43 AM
#3
Re: Drag & Drop
Why can't you do it directly from the app that contains the listview?
-
May 22nd, 2005, 01:40 PM
#4
Re: Drag & Drop
He wants to drop a filename from a list onto an .exe to have it open. (ie mp3 onto player)
-
May 22nd, 2005, 03:06 PM
#5
Thread Starter
Need-a-life Member
Re: Drag & Drop
I want to drop the selected files (which are not files obviously) in my app's listview into anything. For example, if I drop them into the desktop, I want Windows to copy these files into that location.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 22nd, 2005, 03:10 PM
#6
Re: Drag & Drop
You need to change your listview to Manual dragdrop. When its automatic the listview does not designate text as the source data.
You can test this out by dragging a text file from explorer to your exe and drop it on to it. The path and filename will popup. With the
listview being in automatic DND you can not specify the item to pass as the source data.
Set your listview as manual DND and then write the procedures to initiate the DND and set the data source as the selected listview item's text property.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 22nd, 2005, 03:14 PM
#7
Thread Starter
Need-a-life Member
Re: Drag & Drop
 Originally Posted by RobDog888
You need to change your listview to Manual dragdrop. When its automatic the listview does not designate text as the source data.
You can test this out by dragging a text file from explorer to your exe and drop it on to it. The path and filename will popup. With the
listview being in automatic DND you can not specify the item to pass as the source data.
Set your listview as manual DND and then write the procedures to initiate the DND and set the data source as the selected listview item's text property.
I figured that much already... but I don't know how to set the data so that it can be interpreted correctly by Windows. I tried to:
VB Code:
Data.Files.Add "C:\test.txt"
but didn't work.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 22nd, 2005, 03:16 PM
#8
Re: Drag & Drop
You probably need to use these three procedures...
VB Code:
Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
End Sub
Private Sub ListView1_OLESetData(Data As MSComctlLib.DataObject, DataFormat As Integer)
End Sub
Private Sub ListView1_OLECompleteDrag(Effect As Long)
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 22nd, 2005, 03:19 PM
#9
Thread Starter
Need-a-life Member
Re: Drag & Drop
 Originally Posted by RobDog888
You probably need to use these three procedures...
VB Code:
Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
End Sub
Private Sub ListView1_OLESetData(Data As MSComctlLib.DataObject, DataFormat As Integer)
End Sub
Private Sub ListView1_OLECompleteDrag(Effect As Long)
End Sub
Ok... but how should I populate the Data object? The line I tried did not work.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 22nd, 2005, 04:21 PM
#10
Re: Drag & Drop
This is what I tried but I think there is still more needed?
VB Code:
'Using Automatic drop mode and setting the drag data.
Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
Data.Clear
AllowedEffects = vbDropEffectCopy
Data.SetData ListView1.SelectedItem.Text, vbCFText
End Sub
Private Sub ListView1_OLESetData(Data As MSComctlLib.DataObject, DataFormat As Integer)
Data.SetData ListView1.SelectedItem.Text, vbCFText
End Sub
Private Sub ListView1_OLECompleteDrag(Effect As Long)
Effect = vbDropEffectCopy '?
End Sub
Using the Manuladrop mode requires more code, but automatic says it can allow you to set the data manually but it still isnt working.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 23rd, 2005, 08:42 AM
#11
Thread Starter
Need-a-life Member
Re: Drag & Drop
 Originally Posted by RobDog888
This is what I tried but I think there is still more needed?
VB Code:
'Using Automatic drop mode and setting the drag data.
Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
Data.Clear
AllowedEffects = vbDropEffectCopy
Data.SetData ListView1.SelectedItem.Text, vbCFText
End Sub
Private Sub ListView1_OLESetData(Data As MSComctlLib.DataObject, DataFormat As Integer)
Data.SetData ListView1.SelectedItem.Text, vbCFText
End Sub
Private Sub ListView1_OLECompleteDrag(Effect As Long)
Effect = vbDropEffectCopy '?
End Sub
Using the Manuladrop mode requires more code, but automatic says it can allow you to set the data manually but it still isnt working.
I cannot drop it anywhere the "forbidden" icon is shown everywhere. How can I change it to automatic drop. ListView's OLEDropMode can be none or manual.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
May 23rd, 2005, 10:28 AM
#12
Re: Drag & Drop
I'm not too sure since I havent used DND this way. My code example was just illustrate some of the stuff needed, but is only half the
issue. Its not complete or functional.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|