Click here to Skip to main content
16,008,750 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMemory Allocation problem Pin
ISIS5511-Feb-02 9:24
ISIS5511-Feb-02 9:24 
GeneralRe: Memory Allocation problem Pin
Joaquín M López Muñoz11-Feb-02 9:41
Joaquín M López Muñoz11-Feb-02 9:41 
GeneralRe: Memory Allocation problem Pin
Tim Smith11-Feb-02 9:54
Tim Smith11-Feb-02 9:54 
GeneralRe: Memory Allocation problem Pin
ISIS5511-Feb-02 10:40
ISIS5511-Feb-02 10:40 
GeneralCFile::write | create and Windows 2000/XP Pin
mimi11-Feb-02 8:59
mimi11-Feb-02 8:59 
GeneralRe: CFile::write | create and Windows 2000/XP Pin
Mazdak11-Feb-02 9:40
Mazdak11-Feb-02 9:40 
GeneralMANY THANKS ! Pin
mimi11-Feb-02 10:15
mimi11-Feb-02 10:15 
GeneralTrying to use CFormView in a dialog :o) Pin
Jon Hulatt11-Feb-02 8:28
Jon Hulatt11-Feb-02 8:28 
Confused | :confused: Hello people.

I'm trying to get a CFormView derived class inside of a dialog. Why? well, i want a small area of my dialog to be kind of a sub dialog, with dynamically created controls in it. CFormView is a nice way to go, cos then i get scroll functionality on this little pane.

Anyway. Trying to add the view like this:

CRect rect(10, 10, 200, 200);
CRuntimeClass* pClass = RUNTIME_CLASS(CMyFormView);
pView = (CMyFormView*)pClass->CreateObject();
pView->Create(NULL, NULL, WS_CHILD, rect, this, AFX_IDW_PANE_FIRST, NULL);
pView->MoveWindow(rect);
pView->ShowWindow(SW_SHOW);


This doesn't work. The compiler generates an error on the pView->Create() line. This is because the Create() member (which comes from the base class) is protected:. but I don't understand why it's protected! it's not in CView, and not in CScrollView.

So what I tried next, was adding a virtual function, Create() to the CMyFormView class. the supplied virtual function calls the base class implementation, using the parameters passed in. ie:

BOOL CMyFormView::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 CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}


This seemed a good idea, because the virtual function is allowed to call the protected base class member. However, running the code causes an assert, in the base class create... ie CFormView::Create()...

if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
{
    ASSERT(FALSE);          // invalid dialog template name


Something's wrong with the dialog template name. But I thought this was handled by the framework on my behalf? I specified a dialog resource when I created the class, and the enum IDD in the class declaration of my dirived class reflects this. Any clues as to how to get a working CFormView inside a dialog???

Your help will earn you a beer!!!

Thanks

Jon

Sorry to dissapoint you all with my lack of a witty or poignant signature.
GeneralWhy I now feel like a spanner Pin
Jon Hulatt11-Feb-02 8:30
Jon Hulatt11-Feb-02 8:30 
GeneralCListCtrl report - resizeing columns (resezing same in Outlook 98/2000/2002 - solution !(?) ) Pin
Wizard_0111-Feb-02 4:28
Wizard_0111-Feb-02 4:28 
GeneralRe: CListCtrl report - resizeing columns (resezing same in Outlook 98/2000/2002 - solution !(?) ) Pin
Joaquín M López Muñoz11-Feb-02 5:07
Joaquín M López Muñoz11-Feb-02 5:07 
GeneralRe: CListCtrl report - resizeing columns (resezing same in Outlook 98/2000/2002 - solution !(?) ) Pin
Wizard_0111-Feb-02 5:15
Wizard_0111-Feb-02 5:15 
Questionhow to set default size of propertypage Pin
parag11-Feb-02 3:45
parag11-Feb-02 3:45 
AnswerRe: how to set default size of propertypage Pin
Joaquín M López Muñoz11-Feb-02 4:26
Joaquín M López Muñoz11-Feb-02 4:26 
QuestionWhy do my radio buttons never appear in Classwizard? Pin
Jon Hulatt11-Feb-02 3:17
Jon Hulatt11-Feb-02 3:17 
AnswerRe: Why do my radio buttons never appear in Classwizard? Pin
Mazdak11-Feb-02 3:32
Mazdak11-Feb-02 3:32 
AnswerRe: Why do my radio buttons never appear in Classwizard? Pin
Rickard Andersson2011-Feb-02 3:47
Rickard Andersson2011-Feb-02 3:47 
GeneralRe: Why do my radio buttons never appear in Classwizard? Pin
Jon Hulatt11-Feb-02 4:20
Jon Hulatt11-Feb-02 4:20 
AnswerRe: Why do my radio buttons never appear in Classwizard? Pin
Nish Nishant11-Feb-02 5:08
sitebuilderNish Nishant11-Feb-02 5:08 
QuestionWizards in WinCe? Pin
VanHlebar11-Feb-02 3:00
VanHlebar11-Feb-02 3:00 
GeneralVisual C++ & OpenGL Pin
Rajveer11-Feb-02 2:42
Rajveer11-Feb-02 2:42 
GeneralSubclassing a CListCtrl Pin
Jerome Conus11-Feb-02 2:31
Jerome Conus11-Feb-02 2:31 
GeneralRe: Subclassing a CListCtrl Pin
Mazdak11-Feb-02 2:41
Mazdak11-Feb-02 2:41 
GeneralRe: Subclassing a CListCtrl Pin
Sam Levy11-Feb-02 3:12
Sam Levy11-Feb-02 3:12 
GeneralRe: Subclassing a CListCtrl Pin
alex.barylski11-Feb-02 3:39
alex.barylski11-Feb-02 3:39 

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.