VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "IDropTargetClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' Copyright (C) 2007-2010 Jan Vorel
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2 of the License, or
' (at your option) any later version.

' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.

' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

' If you have any questions, suggestions or bug reports about this product,
' contact me: info@ctuser.net; Do not contact me about general B.A.S.I.C.
' language or A.P.I. issues
Option Explicit

Implements IDropTarget

Private xCallProc As Long
Private xGrfKeyState As Long
'Private Declare Function OleGetData Lib "olecli32.dll" (ByVal lpoleobject As Long, ByVal oleclipformat As Integer, ByRef pHandle As Long) As Long

Private Sub IDropTarget_DragEnter(ByVal pDataObj As olelib.IDataObject, ByVal grfKeyState As Long, ByVal ptX As Long, ByVal ptY As Long, pdwEffect As olelib.DROPEFFECTS)
  pdwEffect = 4& '4 link, 2for shift/move, 1 for copy
  xGrfKeyState = grfKeyState
  End Sub

Private Sub IDropTarget_DragLeave()
  '
  End Sub

Private Sub IDropTarget_DragOver(ByVal grfKeyState As Long, ByVal ptX As Long, ByVal ptY As Long, pdwEffect As olelib.DROPEFFECTS)
  If grfKeyState = &HF0F00F0F Then xCallProc = ptX
  pdwEffect = 4&
  xGrfKeyState = grfKeyState
  End Sub

Private Sub IDropTarget_Drop(ByVal pDataObj As olelib.IDataObject, ByVal grfKeyState As Long, ByVal ptX As Long, ByVal ptY As Long, pdwEffect As olelib.DROPEFFECTS)
  'Dim Idx As Long
  Dim xType1 As FORMATETC
  Dim xType2 As STGMEDIUM
 
  xType1.cfFormat = 15&
  xType1.lindex = -1&
  'xType1.pDVTARGETDEVICE = 0&
  xType1.dwAspect = 1&
  xType1.TYMED = TYMED_HGLOBAL
  xType2.TYMED = TYMED_HGLOBAL
  If pDataObj.GetData(xType1, xType2) = 0& Then
    Call CallWindowProcAnsi(xCallProc, xType2.Data, 0&, 0&, xGrfKeyState)
    End If
  pdwEffect = 4&
  End Sub

