VB6 Code to drag & drop objects form our app to external apps.
Assume you want to drag and drop a jpeg picture.
1. Create a form
2. place a image control.
3. Place a nice icon insed of loading the whole picture.
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then Image1.OLEDrag
Private Sub Image1_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean) ' asking
Effect = vbDropEffectCopy 'a copy is droped of the data
Private Sub Image1_OLECompleteDrag(Effect As Long)
Private Sub Image1_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
AllowedEffects = vbDropEffectCopy
' if dragging the filename, then do this
Me.Image1.Tag = "c:\test.jpg"
Data.SetData , vbCFFiles
' if dragging the image, then do this
'Data.SetData LoadPicture(Image1.Tag), vbCFBitmap
' note that you can actually do both and the target will pick which it wants
' do whatever you need to do after data was accepted/rejected, if anything
* This is a sample code posted by lavolp inresponse to my drag & drop question and found that really useful.