Guest_imported
New member
- Jan 1, 1970
- 0
I am implementing drag and drop in a class derived from CWnd.
I want to drag and drop ICONS, I am using the class COleDropTarget to get the drag and drop messages and I redirect them to the class derived from CWnd.
My probles is that when I try to drag an ICON the method
drodrag always returns 0 and I cannot drag the icon. I have already implemented this in a CSCrollView and I did not have problems, this is the code of the class derived from CWnd
// iWndObjContainer.cpp : implementation file
//
#include "stdafx.h"
#include "dragdropdlg.h"
#include "iWidgetDataCenter.h"
#include "iWndObjContainer.h"
#include "iObjDropTarget.h"
#include "iTagWidgetInfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// iWndObjContainer
IMPLEMENT_DYNCREATE(iWndObjContainer,CWnd)
iWndObjContainer::iWndObjContainer()
{
m_bHCursor=false;
}
iWndObjContainer::~iWndObjContainer()
{
}
BEGIN_MESSAGE_MAP(iWndObjContainer, CWnd)
//{{AFX_MSG_MAP(iWndObjContainer)
ON_WM_PAINT()
ON_WM_CREATE()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
ON_WM_SETFOCUS()
ON_WM_KILLFOCUS()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// iWndObjContainer message handlers
void iWndObjContainer::OnPaint()
{
CPaintDC dc(this); // device context for painting
int nCount = pDataCenter->GetWidgetCount ();
if (nCount) {
//
// Draw all widgets.
//
for (int i=0; i<nCount; i++)
pDataCenter->GetWidget (i)->Draw ((CDC*)&dc);
// Draw the selected widget if this view has the input focus.
//
if (pDataCenter->GetSelectedWidget() != -1 && CWnd::GetFocus () == this)
pDataCenter->GetWidget (pDataCenter->GetSelectedWidget())->DrawSelected ((CDC*)&dc);
}
}
int iWndObjContainer::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
this->GetDC()->SetMapMode(MM_TEXT);
m_oleDropTarget.Register(this);
// TODO: Add your specialized creation code here
return 0;
}
void iWndObjContainer::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CWnd::OnLButtonDown(nFlags, point);
pDataCenter->ClickedPoint=point;
int nCount = pDataCenter->GetWidgetCount ();
if (nCount) {
//
// Convert the click point to logical coordinates.
//
CClientDC dc (this);
//OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// Find out whether a widget was clicked.
//
int i;
BOOL bHit = FALSE;
for (i=nCount - 1; i>=0 && !bHit; i--) {
iWidget* pWidget = pDataCenter->GetWidget(i);
if (pWidget->PtInWidget (point)) {
bHit = TRUE;
}
}
//
// If no widget was clicked, change the selection to NULL and exit.
//
if (!bHit) {
pDataCenter->setSelected(-1);
InvalidateRect (NULL, FALSE);
return;
}
//
// Select the widget that was clicked.
//
int nWidgetIndex = i + 1;
if (pDataCenter->GetSelectedWidget() != nWidgetIndex) {
pDataCenter->setSelected( nWidgetIndex);
InvalidateRect (NULL, FALSE);
UpdateWindow ();
}
//
// Begin a drag-and-drop operation involving the selected widget.
//
// HANDLE hData = GetProcessHeap ();
// WIDGETINFO* pWidgetInfo = (WIDGETINFO*) HeapAlloc (hData, 0, sizeof (WIDGETINFO)/*PFNArraySize*/);
HANDLE hData = ::GlobalAlloc (GMEM_MOVEABLE, sizeof (iTagWidgetInfo));
iTagWidgetInfo * pWidgetInfo = (iTagWidgetInfo *) ::GlobalLock (hData);
iWidget* pWidget = pDataCenter->GetWidget (nWidgetIndex);
ASSERT (pWidget != NULL);
CRect rect = pWidget->GetRect ();
pWidgetInfo->cx = point.x - rect.left;
pWidgetInfo->cy = point.y - rect.top;
pWidgetInfo->icon = pWidget->GetIcon();
::GlobalUnlock (hData);
COleDataSource ods;
UINT nFormat = ((CDragDropDlgApp*) AfxGetApp ())->GetClipboardFormat ();
ods.CacheGlobalData (nFormat, hData);
int nOldSel = pDataCenter->GetSelectedWidget();
DROPEFFECT de = ods.DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_MOVE);
if (de == DROPEFFECT_MOVE) {
pDataCenter->RemoveWidget (nWidgetIndex);
int nCount = pDataCenter->GetWidgetCount ();
if (nOldSel == pDataCenter->GetSelectedWidget() || nCount == 0)
pDataCenter->setSelected(-1);
else if (pDataCenter->GetSelectedWidget() >= nCount)
pDataCenter->setSelected(nCount - 1);
UpdateWindow ();
//pDoc->UpdateAllViews (NULL);
}
}
}
BOOL iWndObjContainer::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
/////////////////////////////////////////////////////////////////////////////
// iWndObjContainer message handlers
DROPEFFECT iWndObjContainer::OnDragEnter(COleDataObject* pDataObject,
DWORD dwKeyState, CPoint point)
{
// CScrollView::OnDragEnter(pDataObject, dwKeyState, point);
//
// Convert the drag point to logical coordinates.
//
CClientDC dc (this);
// OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// If a widget is available from the drop source, create a temporary
// widget for drag imaging.
//
UINT nFormat = ((CDragDropDlgApp*) AfxGetApp ())->GetClipboardFormat ();
HGLOBAL hData = pDataObject->GetGlobalData (nFormat);
if (hData != NULL) {
iTagWidgetInfo* pWidgetInfo = (iTagWidgetInfo*) ::GlobalLock (hData);
int x = point.x - pWidgetInfo->cx;
int y = point.y - pWidgetInfo->cy;
m_offset.cx = pWidgetInfo->cx;
m_offset.cy = pWidgetInfo->cy;
HICON icon = pWidgetInfo->icon;
::GlobalUnlock (hData);
::GlobalFree (hData);
pTempWidget = new iWidget (x, y, icon);
m_pointLastImage.x = m_pointLastImage.y = -32000;
m_pointLastMsg = point;
m_PointReal.x=x;
m_PointReal.y=y;
//
// Return DROPEFFECT_COPY if the Ctrl key is down, or DROPEFFECT_MOVE
// if it is not.
//
return (dwKeyState & MK_CONTROL) ?
DROPEFFECT_COPY : DROPEFFECT_MOVE;
}
//
// The cursor isn't carrying a widget. Indicate that the drop target will
// not accept a drop.
//
pTempWidget = NULL;
return DROPEFFECT_NONE;
}
DROPEFFECT iWndObjContainer::OnDragOver(COleDataObject* pDataObject,
DWORD dwKeyState, CPoint point)
{
// CScrollView::OnDragOver(pDataObject, dwKeyState, point);
// Return now if the object being dragged is not a widget.
//
if (pTempWidget == NULL)
return DROPEFFECT_NONE;
//
// Convert the drag point to logical coordinates.
//
CClientDC dc (this);
// OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// If the cursor has moved, erase the old drag image and draw a new one.
//
if (point != m_pointLastMsg) {
CPoint pt (point.x - m_offset.cx, point.y - m_offset.cy);
pTempWidget->DrawDragImage (&dc, m_pointLastImage);
pTempWidget->DrawDragImage (&dc, pt);
m_pointLastImage = pt;
m_pointLastMsg = point;
}
//
// Return DROPEFFECT_COPY if the Ctrl key is down, or DROPEFFECT_MOVE
// if it is not.
//
return (dwKeyState & MK_CONTROL) ?
DROPEFFECT_COPY : DROPEFFECT_MOVE;
}
void iWndObjContainer::OnDragLeave()
{
// CScrollView::OnDragLeave();
//
// Erase the last drag image and delete the temporary widget.
//
if (pTempWidget != NULL) {
CClientDC dc (this);
//OnPrepareDC (&dc);
pTempWidget->DrawDragImage (&dc, m_pointLastImage);
delete pTempWidget;
pTempWidget = NULL;
}
}
BOOL iWndObjContainer::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect,
CPoint point)
{
// CScrollView::OnDrop(pDataObject, dropEffect, point);
//
// Convert the drop point to logical coordinates.
//
CClientDC dc (this);
//OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// Erase the last drag image and delete the temporary widget.
//
if (pTempWidget != NULL) {
pTempWidget->DrawDragImage (&dc, m_pointLastImage);
delete pTempWidget;
pTempWidget = NULL;
}
//
// Retrieve the HGLOBAL from the data object and create a widget.
//
UINT nFormat = ((CDragDropDlgApp*) AfxGetApp ())->GetClipboardFormat ();
HGLOBAL hData = pDataObject->GetGlobalData (nFormat);
if (hData != NULL) {
iTagWidgetInfo* pWidgetInfo = (iTagWidgetInfo*) ::GlobalLock (hData);
int x = point.x - pWidgetInfo->cx;
int y = point.y - pWidgetInfo->cy;
HICON icon = pWidgetInfo->icon;
::GlobalUnlock (hData);
::GlobalFree (hData);
//pDataCenter->CWidgetDoc* pDoc = GetDocument ();
pDataCenter->setSelected(pDataCenter->AddWidget (x, y, icon));
UpdateWindow ();
//pDoc->UpdateAllViews (NULL);
return TRUE;
}
return FALSE;
}
void iWndObjContainer::SetDataCenter(iWidgetDataCenter *pCentre)
{
pDataCenter=pCentre;
}
void iWndObjContainer::OnBeginDrag()
{
UpdateWindow ();
}
void iWndObjContainer::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// TODO: Add your message handler code here and/or call default
int nCount = pDataCenter->GetWidgetCount ();
if (nCount) {
//
// Convert the click point to logical coordinates.
//
CClientDC dc (this);
//OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// Find out whether a widget was clicked.
//
int i;
BOOL bHit = FALSE;
for (i=nCount - 1; i>=0 && !bHit; i--) {
iWidget* pWidget = pDataCenter->GetWidget (i);
if (pWidget->PtInWidget (point)) {
bHit = TRUE;
}
}
//
// If no widget was clicked, change the selection to NULL and exit.
//
if (!bHit) {
m_bHCursor=false;
InvalidateRect (NULL, FALSE);
}
else
m_bHCursor=true;
SendMessage(WM_SETCURSOR,0,0);
}
CWnd::OnMouseMove(nFlags, point);
}
BOOL iWndObjContainer::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
if (m_bHCursor)
{
SetCursor(AfxGetApp()->LoadCursor(IDC_HAND_CURSOR));
return m_bHCursor;
}
else
return CWnd::OnSetCursor(pWnd, nHitTest, message);
}
void iWndObjContainer::OnSetFocus(CWnd* pOldWnd)
{
CWnd::OnSetFocus(pOldWnd);
InvalidateRect (NULL, FALSE);
// TODO: Add your message handler code here
}
void iWndObjContainer::OnKillFocus(CWnd* pNewWnd)
{
CWnd::OnKillFocus(pNewWnd);
InvalidateRect (NULL, FALSE);
// TODO: Add your message handler code here
}
I hope you can help me!
I want to drag and drop ICONS, I am using the class COleDropTarget to get the drag and drop messages and I redirect them to the class derived from CWnd.
My probles is that when I try to drag an ICON the method
drodrag always returns 0 and I cannot drag the icon. I have already implemented this in a CSCrollView and I did not have problems, this is the code of the class derived from CWnd
// iWndObjContainer.cpp : implementation file
//
#include "stdafx.h"
#include "dragdropdlg.h"
#include "iWidgetDataCenter.h"
#include "iWndObjContainer.h"
#include "iObjDropTarget.h"
#include "iTagWidgetInfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// iWndObjContainer
IMPLEMENT_DYNCREATE(iWndObjContainer,CWnd)
iWndObjContainer::iWndObjContainer()
{
m_bHCursor=false;
}
iWndObjContainer::~iWndObjContainer()
{
}
BEGIN_MESSAGE_MAP(iWndObjContainer, CWnd)
//{{AFX_MSG_MAP(iWndObjContainer)
ON_WM_PAINT()
ON_WM_CREATE()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
ON_WM_SETFOCUS()
ON_WM_KILLFOCUS()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// iWndObjContainer message handlers
void iWndObjContainer::OnPaint()
{
CPaintDC dc(this); // device context for painting
int nCount = pDataCenter->GetWidgetCount ();
if (nCount) {
//
// Draw all widgets.
//
for (int i=0; i<nCount; i++)
pDataCenter->GetWidget (i)->Draw ((CDC*)&dc);
// Draw the selected widget if this view has the input focus.
//
if (pDataCenter->GetSelectedWidget() != -1 && CWnd::GetFocus () == this)
pDataCenter->GetWidget (pDataCenter->GetSelectedWidget())->DrawSelected ((CDC*)&dc);
}
}
int iWndObjContainer::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
this->GetDC()->SetMapMode(MM_TEXT);
m_oleDropTarget.Register(this);
// TODO: Add your specialized creation code here
return 0;
}
void iWndObjContainer::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CWnd::OnLButtonDown(nFlags, point);
pDataCenter->ClickedPoint=point;
int nCount = pDataCenter->GetWidgetCount ();
if (nCount) {
//
// Convert the click point to logical coordinates.
//
CClientDC dc (this);
//OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// Find out whether a widget was clicked.
//
int i;
BOOL bHit = FALSE;
for (i=nCount - 1; i>=0 && !bHit; i--) {
iWidget* pWidget = pDataCenter->GetWidget(i);
if (pWidget->PtInWidget (point)) {
bHit = TRUE;
}
}
//
// If no widget was clicked, change the selection to NULL and exit.
//
if (!bHit) {
pDataCenter->setSelected(-1);
InvalidateRect (NULL, FALSE);
return;
}
//
// Select the widget that was clicked.
//
int nWidgetIndex = i + 1;
if (pDataCenter->GetSelectedWidget() != nWidgetIndex) {
pDataCenter->setSelected( nWidgetIndex);
InvalidateRect (NULL, FALSE);
UpdateWindow ();
}
//
// Begin a drag-and-drop operation involving the selected widget.
//
// HANDLE hData = GetProcessHeap ();
// WIDGETINFO* pWidgetInfo = (WIDGETINFO*) HeapAlloc (hData, 0, sizeof (WIDGETINFO)/*PFNArraySize*/);
HANDLE hData = ::GlobalAlloc (GMEM_MOVEABLE, sizeof (iTagWidgetInfo));
iTagWidgetInfo * pWidgetInfo = (iTagWidgetInfo *) ::GlobalLock (hData);
iWidget* pWidget = pDataCenter->GetWidget (nWidgetIndex);
ASSERT (pWidget != NULL);
CRect rect = pWidget->GetRect ();
pWidgetInfo->cx = point.x - rect.left;
pWidgetInfo->cy = point.y - rect.top;
pWidgetInfo->icon = pWidget->GetIcon();
::GlobalUnlock (hData);
COleDataSource ods;
UINT nFormat = ((CDragDropDlgApp*) AfxGetApp ())->GetClipboardFormat ();
ods.CacheGlobalData (nFormat, hData);
int nOldSel = pDataCenter->GetSelectedWidget();
DROPEFFECT de = ods.DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_MOVE);
if (de == DROPEFFECT_MOVE) {
pDataCenter->RemoveWidget (nWidgetIndex);
int nCount = pDataCenter->GetWidgetCount ();
if (nOldSel == pDataCenter->GetSelectedWidget() || nCount == 0)
pDataCenter->setSelected(-1);
else if (pDataCenter->GetSelectedWidget() >= nCount)
pDataCenter->setSelected(nCount - 1);
UpdateWindow ();
//pDoc->UpdateAllViews (NULL);
}
}
}
BOOL iWndObjContainer::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
/////////////////////////////////////////////////////////////////////////////
// iWndObjContainer message handlers
DROPEFFECT iWndObjContainer::OnDragEnter(COleDataObject* pDataObject,
DWORD dwKeyState, CPoint point)
{
// CScrollView::OnDragEnter(pDataObject, dwKeyState, point);
//
// Convert the drag point to logical coordinates.
//
CClientDC dc (this);
// OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// If a widget is available from the drop source, create a temporary
// widget for drag imaging.
//
UINT nFormat = ((CDragDropDlgApp*) AfxGetApp ())->GetClipboardFormat ();
HGLOBAL hData = pDataObject->GetGlobalData (nFormat);
if (hData != NULL) {
iTagWidgetInfo* pWidgetInfo = (iTagWidgetInfo*) ::GlobalLock (hData);
int x = point.x - pWidgetInfo->cx;
int y = point.y - pWidgetInfo->cy;
m_offset.cx = pWidgetInfo->cx;
m_offset.cy = pWidgetInfo->cy;
HICON icon = pWidgetInfo->icon;
::GlobalUnlock (hData);
::GlobalFree (hData);
pTempWidget = new iWidget (x, y, icon);
m_pointLastImage.x = m_pointLastImage.y = -32000;
m_pointLastMsg = point;
m_PointReal.x=x;
m_PointReal.y=y;
//
// Return DROPEFFECT_COPY if the Ctrl key is down, or DROPEFFECT_MOVE
// if it is not.
//
return (dwKeyState & MK_CONTROL) ?
DROPEFFECT_COPY : DROPEFFECT_MOVE;
}
//
// The cursor isn't carrying a widget. Indicate that the drop target will
// not accept a drop.
//
pTempWidget = NULL;
return DROPEFFECT_NONE;
}
DROPEFFECT iWndObjContainer::OnDragOver(COleDataObject* pDataObject,
DWORD dwKeyState, CPoint point)
{
// CScrollView::OnDragOver(pDataObject, dwKeyState, point);
// Return now if the object being dragged is not a widget.
//
if (pTempWidget == NULL)
return DROPEFFECT_NONE;
//
// Convert the drag point to logical coordinates.
//
CClientDC dc (this);
// OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// If the cursor has moved, erase the old drag image and draw a new one.
//
if (point != m_pointLastMsg) {
CPoint pt (point.x - m_offset.cx, point.y - m_offset.cy);
pTempWidget->DrawDragImage (&dc, m_pointLastImage);
pTempWidget->DrawDragImage (&dc, pt);
m_pointLastImage = pt;
m_pointLastMsg = point;
}
//
// Return DROPEFFECT_COPY if the Ctrl key is down, or DROPEFFECT_MOVE
// if it is not.
//
return (dwKeyState & MK_CONTROL) ?
DROPEFFECT_COPY : DROPEFFECT_MOVE;
}
void iWndObjContainer::OnDragLeave()
{
// CScrollView::OnDragLeave();
//
// Erase the last drag image and delete the temporary widget.
//
if (pTempWidget != NULL) {
CClientDC dc (this);
//OnPrepareDC (&dc);
pTempWidget->DrawDragImage (&dc, m_pointLastImage);
delete pTempWidget;
pTempWidget = NULL;
}
}
BOOL iWndObjContainer::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect,
CPoint point)
{
// CScrollView::OnDrop(pDataObject, dropEffect, point);
//
// Convert the drop point to logical coordinates.
//
CClientDC dc (this);
//OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// Erase the last drag image and delete the temporary widget.
//
if (pTempWidget != NULL) {
pTempWidget->DrawDragImage (&dc, m_pointLastImage);
delete pTempWidget;
pTempWidget = NULL;
}
//
// Retrieve the HGLOBAL from the data object and create a widget.
//
UINT nFormat = ((CDragDropDlgApp*) AfxGetApp ())->GetClipboardFormat ();
HGLOBAL hData = pDataObject->GetGlobalData (nFormat);
if (hData != NULL) {
iTagWidgetInfo* pWidgetInfo = (iTagWidgetInfo*) ::GlobalLock (hData);
int x = point.x - pWidgetInfo->cx;
int y = point.y - pWidgetInfo->cy;
HICON icon = pWidgetInfo->icon;
::GlobalUnlock (hData);
::GlobalFree (hData);
//pDataCenter->CWidgetDoc* pDoc = GetDocument ();
pDataCenter->setSelected(pDataCenter->AddWidget (x, y, icon));
UpdateWindow ();
//pDoc->UpdateAllViews (NULL);
return TRUE;
}
return FALSE;
}
void iWndObjContainer::SetDataCenter(iWidgetDataCenter *pCentre)
{
pDataCenter=pCentre;
}
void iWndObjContainer::OnBeginDrag()
{
UpdateWindow ();
}
void iWndObjContainer::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// TODO: Add your message handler code here and/or call default
int nCount = pDataCenter->GetWidgetCount ();
if (nCount) {
//
// Convert the click point to logical coordinates.
//
CClientDC dc (this);
//OnPrepareDC (&dc);
dc.DPtoLP (&point);
//
// Find out whether a widget was clicked.
//
int i;
BOOL bHit = FALSE;
for (i=nCount - 1; i>=0 && !bHit; i--) {
iWidget* pWidget = pDataCenter->GetWidget (i);
if (pWidget->PtInWidget (point)) {
bHit = TRUE;
}
}
//
// If no widget was clicked, change the selection to NULL and exit.
//
if (!bHit) {
m_bHCursor=false;
InvalidateRect (NULL, FALSE);
}
else
m_bHCursor=true;
SendMessage(WM_SETCURSOR,0,0);
}
CWnd::OnMouseMove(nFlags, point);
}
BOOL iWndObjContainer::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
if (m_bHCursor)
{
SetCursor(AfxGetApp()->LoadCursor(IDC_HAND_CURSOR));
return m_bHCursor;
}
else
return CWnd::OnSetCursor(pWnd, nHitTest, message);
}
void iWndObjContainer::OnSetFocus(CWnd* pOldWnd)
{
CWnd::OnSetFocus(pOldWnd);
InvalidateRect (NULL, FALSE);
// TODO: Add your message handler code here
}
void iWndObjContainer::OnKillFocus(CWnd* pNewWnd)
{
CWnd::OnKillFocus(pNewWnd);
InvalidateRect (NULL, FALSE);
// TODO: Add your message handler code here
}
I hope you can help me!