Print Page | Close Window

no view in my mfc

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Visual C++ MFC
Forum Description: Topics related to Codejock Visual C++ MFC products
URL: http://forum.codejock.com/forum_posts.asp?TID=13150
Printed Date: 21 November 2024 at 6:44pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: no view in my mfc
Posted By: jjqin
Subject: no view in my mfc
Date Posted: 12 January 2009 at 12:52pm
Hi support,
 
In my project which is mfc but linked codejock as static lib and in my project which do not have view class and every thing it doing in the child frame class.  I had a lot crush cause by dc.m_hDC = NULL.  Any idea to fix this quickly?
 
Thanks in the advance.
 
-JianJing



Replies:
Posted By: mdoubson
Date Posted: 08 April 2009 at 11:00pm
Child frame should have some internal content - usually created in virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
Do you have one?
e.g. in my sample used new MS FeaturePack I use it this way as like to have calendar and datepiker in one child frame but you can eliminate splitter and create only calendar control here
 
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
 BOOL bRet = TRUE;//CMDIChildWndEx::OnCreateClient(lpcs, pContext);
   if (!m_wndSplitter.CreateStatic(this, 1, 2))
    {
        TRACE0("Failed to create split bar ");
        return FALSE;
   }
 VERIFY(m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CCalViewNew),CSize(200, 200),pContext));
 VERIFY(m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CDatePickerView),CSize(200, 200),pContext));
 bReady = TRUE;
 
 CMainFrame* pMain = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
 if (pMain)
 {
  CCalViewNew* pCal = DYNAMIC_DOWNCAST(CCalViewNew, m_wndSplitter.GetPane(0,0));
  if (pCal)
   pCal->m_CalendarController.SetDatePicker(pMain->m_Picker);  
 }
 return bRet;
}
 
Another approach - create calendar in dialog - there is sample how to implement it (look in Forum - there is a link to my recent source)


-------------
Mark Doubson, Ph.D.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net