Click here to Skip to main content
15,902,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Multiple monitor support for MFC application Pin
JackDingler7-Feb-12 8:51
JackDingler7-Feb-12 8:51 
GeneralRe: Multiple monitor support for MFC application Pin
Ashish Ranjan Mishra7-Feb-12 16:01
Ashish Ranjan Mishra7-Feb-12 16:01 
GeneralRe: Multiple monitor support for MFC application Pin
JackDingler7-Feb-12 16:45
JackDingler7-Feb-12 16:45 
AnswerRe: Multiple monitor support for MFC application Pin
Anu_Bala7-Feb-12 23:23
Anu_Bala7-Feb-12 23:23 
QuestionVS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1235-Feb-12 10:05
Fallen1235-Feb-12 10:05 
AnswerRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Eugen Podsypalnikov5-Feb-12 20:32
Eugen Podsypalnikov5-Feb-12 20:32 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1235-Feb-12 23:48
Fallen1235-Feb-12 23:48 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1238-Feb-12 1:51
Fallen1238-Feb-12 1:51 
A bit stuck on placing frame on dialog
Added Cframewnd LBA Via class wizard to project
Edited in the following

LBA.h
pragma once
#include "listboxadv.h"
#include "afxwin.h"
#include "MediaPlayer.h"


// LBA frame

class LBA : public CFrameWnd
{
	DECLARE_DYNCREATE(LBA)
public:
	LBA();           // protected constructor used by dynamic creation
	virtual ~LBA();

protected:
	DECLARE_MESSAGE_MAP()
public:
	CToolBar m_toolbar;
	ListBoxAdv m_list; 
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);

        //Items added to the toolbar 
	CComboBox m_combobox;
	CEdit m_searchfor;
	CEdit m_sortstring;
};

LBA.cpp
C++
/ LBA.cpp : implementation file
//

#include "stdafx.h"
#include "MediaPlayer.h"
#include "LBA.h"


// LBA

IMPLEMENT_DYNCREATE(LBA, CFrameWnd)

LBA::LBA()
{

}

LBA::~LBA()
{
	if(IsWindow(m_toolbar.GetSafeHwnd()))m_toolbar.DestroyWindow();
	if(IsWindow(m_list.GetSafeHwnd()))m_list.DestroyWindow();
	if(IsWindow(m_searchfor.GetSafeHwnd()))m_searchfor.DestroyWindow();
	if(IsWindow(m_combobox.GetSafeHwnd()))m_combobox.DestroyWindow();
	if(IsWindow(m_sortstring.GetSafeHwnd()))m_sortstring.DestroyWindow();
}


BEGIN_MESSAGE_MAP(LBA, CFrameWnd)
	ON_WM_CREATE()
	ON_WM_SIZE()
END_MESSAGE_MAP()


// LBA message handlers


int LBA::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	CRect rec;
	int i;
.... all the toolbar code


Then used dialog editor -- added Picturebox as a placeholder,and control variable m_ctrllist
Edited dialog header so
LBA m_ctrllist

And ran the code

resized m_ctrllist in dialog::OnInitDialog --LBA::OnSize was called worked fine

BUT -- Had a break in LBA::OnCreate it was never tripped
and dialog shows a picture box (as you would expect since OnCreate was never invoked)

So tried deleting the picturebox and added to Dialog::OnCreate() the following
C++
CRect rec;
m_ctrllist.Create(_T("FrameWnd"),NULL,WS_VISIBLE|WS_CHILD,rec,this,NULL,0);

Heap errors up the yazoo

I'm Missing something very basic
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Jochen Arndt8-Feb-12 2:04
professionalJochen Arndt8-Feb-12 2:04 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1238-Feb-12 2:44
Fallen1238-Feb-12 2:44 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Jochen Arndt8-Feb-12 3:19
professionalJochen Arndt8-Feb-12 3:19 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1238-Feb-12 4:04
Fallen1238-Feb-12 4:04 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Jochen Arndt8-Feb-12 4:20
professionalJochen Arndt8-Feb-12 4:20 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1238-Feb-12 4:44
Fallen1238-Feb-12 4:44 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Eugen Podsypalnikov8-Feb-12 4:53
Eugen Podsypalnikov8-Feb-12 4:53 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1239-Feb-12 10:19
Fallen1239-Feb-12 10:19 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Eugen Podsypalnikov9-Feb-12 20:30
Eugen Podsypalnikov9-Feb-12 20:30 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen12310-Feb-12 5:35
Fallen12310-Feb-12 5:35 
AnswerRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Richard MacCutchan5-Feb-12 23:17
mveRichard MacCutchan5-Feb-12 23:17 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1235-Feb-12 23:38
Fallen1235-Feb-12 23:38 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Richard MacCutchan6-Feb-12 0:04
mveRichard MacCutchan6-Feb-12 0:04 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1236-Feb-12 0:35
Fallen1236-Feb-12 0:35 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Richard MacCutchan6-Feb-12 1:14
mveRichard MacCutchan6-Feb-12 1:14 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Fallen1236-Feb-12 2:16
Fallen1236-Feb-12 2:16 
GeneralRe: VS 2010 MFC derived CListbox with dynamically addedCtoolbar Pin
Richard MacCutchan6-Feb-12 3:03
mveRichard MacCutchan6-Feb-12 3:03 

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.