/*
*********************************************************************
*
*	The Essence of OLE
*
*	Source code sample
*
*	Copyright (c) 1996, Rolling Thunder Computing, Ipswich MA
*
*	e-mail: essence@rollthunder.com
*	CompuServe: 73540.3430
*	Web: http://www.rollthunder.com
*
*	File Name: CDROPTGT.CPP
*
*	Purpose: Implementation of IDropTarget interface
*
*********************************************************************
*/

#include <windows.h>
#include "cdroptgt.h"

extern HWND hMainWnd ;
extern int xText, yText ;
extern char DisplayText[] ;

/*
Constructor/destructor 
*/

CDropTarget::CDropTarget(void)
{   
	m_RefCount = 1 ;		// calling constructor implies AddRef( )
    return;
}


CDropTarget::~CDropTarget(void)
{
    return;
}


/*
IUnknown methods
*/

HRESULT CDropTarget::QueryInterface(REFIID riid, LPVOID FAR *ppv)
{


    if (riid == IID_IUnknown || riid == IID_IDropTarget)
    {
	    *ppv = (LPVOID)this;  
        AddRef();
        return S_OK ;
    }
    else
    {
    	*ppv = NULL;       
    	return  E_NOINTERFACE ;
    }
}


STDMETHODIMP_(ULONG) CDropTarget::AddRef(void)
{
    m_RefCount ++ ;
    return m_RefCount ;
}


STDMETHODIMP_(ULONG) CDropTarget::Release(void)
{
    ULONG ReleaseCount ;

    m_RefCount -- ;
    ReleaseCount = m_RefCount ;
    
    if (m_RefCount == 0L)
    {   
    	delete this;
    }

    return ReleaseCount ;
}


/*
IDropTarget methods
*/

STDMETHODIMP CDropTarget::DragEnter(LPDATAOBJECT pIDataSource, 
	DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
    
/*
STEP 5  Add DragEnter( ) code
*/


    return S_OK ;
}
                      

STDMETHODIMP CDropTarget::DragOver(DWORD grfKeyState, POINTL pt, 
	LPDWORD pdwEffect)
{

/*
STEP 6  Add DragOver( ) code
*/
        
    return S_OK;
}


/*
Drag operation is leaving our window without dropping.  Release our hold
on the data object.
*/

STDMETHODIMP CDropTarget::DragLeave(void)
{

/*
STEP 7  Add DragLeave( ) code
*/


    return S_OK;
}


STDMETHODIMP CDropTarget::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, 
	POINTL pt, LPDWORD pdwEffect)
{   
		
/*
STEP 8  Add Drop( ) code
*/

		
	return S_OK;
}
