- dynscreens.zip
- AddToYourProject
- help
- MFC Screen Designer FREE classes.doc
- MFC Screen Designer FREE classes.pdf
- MFC Screen Designer Retail Classes.doc
- MFC Screen Designer Retail Classes.pdf
- SAMPLE
- FV - VC7
- FV
- NewExample - VC7
- NewExample
- screenshot.gif
- UseInYourProject
- dynscreen.rc
- res
- checkcurs.cur
- combocurs.cur
- datecurs.cur
- dyntoolbar.bmp
- editcurs.cur
- groupcurs.cur
- labelcurs.cur
- multieditcurs.cur
- radiocurs.cur
|
// Copyright � 2002 Oink!
// FILE NAME : DynDropTarget.cpp
// DESCRIPTION : Provides basic member variables and functions for all
// : CWnd objects to act as drop target for control dragged from
// : toolbar
//
// PROGRAMMER DATE PATCH DESCRIPTION
// ============ =========== ======= ===============================================
#include "stdafx.h"
#include "dynscreen.h"
#include "dyndroptarget.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDynDropTarget
IMPLEMENT_DYNCREATE(CDynDropTarget, CCmdTarget)
CDynDropTarget::CDynDropTarget()
{
}
CDynDropTarget::~CDynDropTarget()
{
}
BEGIN_MESSAGE_MAP(CDynDropTarget, COleDropTarget)
//{{AFX_MSG_MAP(CDynDropTarget)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDynDropTarget message handlers
BOOL CDynDropTarget::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect,CPoint point)
{
// Detects a drop and adds a new control to the screen
if (!(pDataObject->IsDataAvailable(m_nIDClipFormat)))
return FALSE;
STGMEDIUM stgmedium;
int nType;
{
if (pDataObject->GetData(m_nIDClipFormat, &stgmedium))
{
HGLOBAL hGlobal = stgmedium.hGlobal;
LPCTSTR pText = (LPCTSTR)GlobalLock(hGlobal);
nType = atoi(pText);
// free memory
GlobalUnlock(hGlobal);
GlobalFree(hGlobal);
}
pWnd->SendMessage(WM_ADDCONTROL,(WPARAM)nType,(LPARAM)&point);
}
return FALSE;
}
DROPEFFECT CDynDropTarget::OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point )
{
// Determines if data is available to drop
if (pDataObject->IsDataAvailable(m_nIDClipFormat))
return DROPEFFECT_COPY;
return DROPEFFECT_NONE;
}
DROPEFFECT CDynDropTarget::OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point )
{
// Determines if data is available to drop
CString strPos;
strPos.Format(" x: %d, y: %d ",point.x,point.y);
if (pDataObject->IsDataAvailable(m_nIDClipFormat))
return DROPEFFECT_COPY;
return DROPEFFECT_NONE;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.