Click here to Skip to main content
11,802,636 members (71,572 online)
Click here to Skip to main content
Add your own
alternative version

DirectUI Window as in XP system folders

, 1 Aug 2004 CPOL 201.7K 7.1K 169
A control to show a list of possible tasks just as in XP.
// InPlaceEdit2.cpp : implementation file

#include "stdafx.h"
#include "InPlaceEdit2.h"
#include "WndDirectUI.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;

// CInPlaceEdit

CInPlaceEdit2::CInPlaceEdit2(CString sInitText, CDirectUIItemEdit* pParent)
:m_sInitText( sInitText )
	m_bESC = FALSE;
	m_pParent = pParent;



// CInPlaceEdit message handlers

BOOL CInPlaceEdit2::PreTranslateMessage(MSG* pMsg)
	if( pMsg->message == WM_KEYDOWN )
		if(pMsg->wParam == VK_RETURN
		|| pMsg->wParam == VK_DELETE
		|| pMsg->wParam == VK_ESCAPE
		|| GetKeyState( VK_CONTROL))
			return TRUE;    // DO NOT process further
	return CEdit::PreTranslateMessage(pMsg);

void CInPlaceEdit2::OnKillFocus(CWnd* pNewWnd)


void CInPlaceEdit2::OnNcDestroy()
	CString str;
	m_pParent->m_pEdit = NULL;


	delete this;

void CInPlaceEdit2::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
	// Include the following lines if you want to close the control
	// by pressing ESC or ENTER

	if( nChar == VK_ESCAPE || nChar == VK_RETURN)
		if( nChar == VK_ESCAPE )
			m_bESC = TRUE;

	CEdit::OnChar(nChar, nRepCnt, nFlags);

int CInPlaceEdit2::OnCreate(LPCREATESTRUCT lpCreateStruct)
	if (CEdit::OnCreate(lpCreateStruct) == -1)
	return -1;

	// Set the proper font

	SetWindowText( m_sInitText );
	SetSel( 0, -1 );
	return 0;

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Alexander Bischofberger
Web Developer
Germany Germany
Ok, a few words about me:

I started programming on the C64 by the "trial and error" method. Years later my parents got their first PC (Atari PC4, AT 8 MHz) where I started with Turbo Pascal. The next steps led to Turbo Pascal for Windows, Visual C++ 1.52c, and finally Visual C++ 6.

I had several chances to code larger projects, e.g.
* stand-alone disc copy station software (Win 3.1) with automatic reboot, disc encryption, ...
* government-used strategic decision system
* MLM marketing tool (
* maintenance for show planning system and other TV software (

A lot of code, tipps and help came from this site for my later projects. Thanks again to all who helped me, even if they don't know it. I'm trying to share code (which is worth sharing) so others can get the help I got (and still need) for everyday problems.

Well, I think that's enough.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151002.1 | Last Updated 2 Aug 2004
Article Copyright 2002 by Alexander Bischofberger
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid