OLE DragDrop - Drops onto It's Self!
Posted on 2000-05-08
How can I keep the following routine from dropping it's own selected text
onto itself? It's a Rich Text Box. When I select some text and drag the mouse it shows that it's dragging it. Then when I release the mouse
button it drops it on itself and deletes everything but the selected text!
It's supposed to just be able to drag-n-drop from other apps (and vice versa). How can I say:
IF Source = YourOwnDamnSelf AND Target = YourOwnDamnSelf then
Private Sub rtbCodeWindow_OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(vbCFText) Then 'if text
If (Effect And vbDropEffectCopy) Then
rtbCodeWindow.TextRTF = Data.GetData(vbCFText) 'set the window to the dragged in text
rtbCodeWindow.LoadFile Data.GetData(vbCFText) 'open the dragged in file
If Data.GetFormat(vbCFFiles) Then 'if files from explorer
rtbCodeWindow.LoadFile Data.Files(1) 'open the file dragged from windows