Click here to Skip to main content
15,910,797 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Add text to listbox using sendmessage, i'm baffled, c++ win32 Pin
David Crow8-Feb-12 4:19
David Crow8-Feb-12 4:19 
AnswerRe: Add text to listbox using sendmessage, i'm baffled, c++ win32 Pin
jkirkerx8-Feb-12 6:17
professionaljkirkerx8-Feb-12 6:17 
AnswerNow it works, strange or I get it now Pin
jkirkerx8-Feb-12 7:22
professionaljkirkerx8-Feb-12 7:22 
AnswerRe: Now it works, strange or I get it now Pin
David Crow8-Feb-12 8:07
David Crow8-Feb-12 8:07 
GeneralRe: Now it works, strange or I get it now Pin
jkirkerx8-Feb-12 9:46
professionaljkirkerx8-Feb-12 9:46 
QuestionVirualiztion concept for Client Server windows application Pin
D.Manivelan6-Feb-12 20:00
D.Manivelan6-Feb-12 20:00 
AnswerRe: Virualiztion concept for Client Server windows application Pin
Albert Holguin6-Feb-12 21:40
professionalAlbert Holguin6-Feb-12 21:40 
GeneralRe: Virualiztion concept for Client Server windows application Pin
Nicolas Dorier7-Feb-12 0:24
professionalNicolas Dorier7-Feb-12 0:24 
GeneralRe: Virualiztion concept for Client Server windows application Pin
Jochen Arndt7-Feb-12 0:48
professionalJochen Arndt7-Feb-12 0:48 
SuggestionRe: Virualiztion concept for Client Server windows application Pin
Albert Holguin8-Feb-12 10:51
professionalAlbert Holguin8-Feb-12 10:51 
AnswerRe: Virualiztion concept for Client Server windows application Pin
Stefan_Lang9-Feb-12 1:28
Stefan_Lang9-Feb-12 1:28 
QuestionMultiple monitor support for MFC application Pin
Ashish Ranjan Mishra6-Feb-12 14:19
Ashish Ranjan Mishra6-Feb-12 14:19 
AnswerRe: Multiple monitor support for MFC application Pin
Albert Holguin6-Feb-12 16:43
professionalAlbert Holguin6-Feb-12 16:43 
GeneralRe: Multiple monitor support for MFC application Pin
Ashish Ranjan Mishra7-Feb-12 16:03
Ashish Ranjan Mishra7-Feb-12 16:03 
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 

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.