Click here to Skip to main content
15,885,278 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: How to get IDOK / IDCANCEL command message from an non-modal dialog set as client in CFrameWindowImpl? Pin
Alain Rist11-Mar-11 9:47
Alain Rist11-Mar-11 9:47 
GeneralRe: How to get IDOK / IDCANCEL command message from an non-modal dialog set as client in CFrameWindowImpl? Pin
Philipp Kursawe17-Mar-11 0:24
Philipp Kursawe17-Mar-11 0:24 
GeneralRe: How to get IDOK / IDCANCEL command message from an non-modal dialog set as client in CFrameWindowImpl? Pin
Alain Rist17-Mar-11 9:49
Alain Rist17-Mar-11 9:49 
QuestionUsing CContainedWindowT in a base class causes assert in conrete class Pin
Philipp Kursawe10-Mar-11 20:39
Philipp Kursawe10-Mar-11 20:39 
AnswerRe: Using CContainedWindowT in a base class causes assert in conrete class Pin
Alain Rist11-Mar-11 10:13
Alain Rist11-Mar-11 10:13 
GeneralRe: Using CContainedWindowT in a base class causes assert in conrete class Pin
Philipp Kursawe13-Mar-11 11:14
Philipp Kursawe13-Mar-11 11:14 
QuestionHow to create an flicker free owner draw listbox using CDoubleBufferWindowImpl? Pin
Philipp Kursawe10-Mar-11 17:57
Philipp Kursawe10-Mar-11 17:57 
AnswerRe: How to create an flicker free owner draw listbox using CDoubleBufferWindowImpl? Pin
Alain Rist13-Mar-11 6:00
Alain Rist13-Mar-11 6:00 
Hi Philipp,

Philipp Kursawe wrote:
I guess the first step would be to move the MSG_WM_DRAWITEM message handling to
my custom listbox control

It may be your choice but it's not the first step.
You need to use a double buffered CListBox, for instance:
class CMyListBox : public CDoubleBufferWindowImpl<CMyListBox, CListBox, ATL::CControlWinTraits>
{
	BEGIN_MSG_MAP(CMyListBox)
		CHAIN_MSG_MAP(CDoubleBufferWindowImpl)
	END_MSG_MAP()
	void DoPaint(HDC hdc)
	{
		DefWindowProc(WM_PAINT, (WPARAM)hdc, 0);
	}
};


If you subclass the listbox in your parent dialog OnInit(), you can check with breakpoints that the dc referenced in your DrawItem() member is the MemoryDC set in CMyListBox::DoPaint().
My test code:
class CTest0View :
 	public CDialogImpl<CTest0View>,
	public COwnerDraw<CTest0View>
{
public:
	enum { IDD = IDD_TEST0_FORM };
	CMyListBox m_lb;
	void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
	{
		// must be implemented
		return;
	}
	BEGIN_MSG_MAP(CTest0View)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInit)
		CHAIN_MSG_MAP(COwnerDraw<CTest0View>)
		FORWARD_NOTIFICATIONS()
	END_MSG_MAP()

	LRESULT OnInit(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
	{
		m_lb.SubclassWindow(GetDlgItem(IDC_LIST1));
		m_lb.AddString(L"Titi");
		m_lb.AddString(L"Tata");
		m_lb.AddString(L"Toto");

		return bHandled = FALSE;
	}
};

cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

GeneralRe: How to create an flicker free owner draw listbox using CDoubleBufferWindowImpl? Pin
Philipp Kursawe13-Mar-11 11:18
Philipp Kursawe13-Mar-11 11:18 
QuestionQuestion about draw my own object in Word. Pin
whiteclouds8-Mar-11 16:03
whiteclouds8-Mar-11 16:03 
QuestionProblems with MFCTabCtrl/MDITabbedControl Pin
Dansveen7-Mar-11 10:26
Dansveen7-Mar-11 10:26 
QuestionNewline as <<ALT + ENTER>> in PreTranslateMessage for MultilineEdit Control Pin
Vishal_K897-Mar-11 0:13
Vishal_K897-Mar-11 0:13 
AnswerRe: Newline as > in PreTranslateMessage for MultilineEdit Control Pin
Cool_Dev7-Mar-11 2:07
Cool_Dev7-Mar-11 2:07 
Questionwrite a C program to find the area and perimeter of a circle? Pin
valyvachouama3-Mar-11 5:54
valyvachouama3-Mar-11 5:54 
AnswerRe: write a C program to find the area and perimeter of a circle? Pin
_AnsHUMAN_ 3-Mar-11 19:18
_AnsHUMAN_ 3-Mar-11 19:18 
GeneralRe: write a C program to find the area and perimeter of a circle? Pin
valyvachouama3-Mar-11 20:32
valyvachouama3-Mar-11 20:32 
GeneralRe: write a C program to find the area and perimeter of a circle? Pin
Richard MacCutchan3-Mar-11 22:11
mveRichard MacCutchan3-Mar-11 22:11 
AnswerRe: write a C program to find the area and perimeter of a circle? Pin
Stephen Hewitt4-Mar-11 17:03
Stephen Hewitt4-Mar-11 17:03 
Questionfreeing pointers in pointer array causes SegFault [solved] Pin
Jordanwb27-Feb-11 9:03
Jordanwb27-Feb-11 9:03 
AnswerRe: freeing pointers in pointer array causes SegFault Pin
Cool_Dev27-Feb-11 19:06
Cool_Dev27-Feb-11 19:06 
AnswerRe: freeing pointers in pointer array causes SegFault Pin
Richard MacCutchan27-Feb-11 23:01
mveRichard MacCutchan27-Feb-11 23:01 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Jordanwb28-Feb-11 4:18
Jordanwb28-Feb-11 4:18 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Richard MacCutchan28-Feb-11 6:10
mveRichard MacCutchan28-Feb-11 6:10 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Jordanwb28-Feb-11 6:57
Jordanwb28-Feb-11 6:57 
QuestionMAPI: MapiRecipDesc is not properly working with Lotus Notes (ver8.5) [modified] Pin
vinvino200122-Feb-11 2:55
vinvino200122-Feb-11 2:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.