Click here to Skip to main content
15,899,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Drawimage Pin
enhzflep9-May-12 2:51
enhzflep9-May-12 2:51 
GeneralRe: Drawimage Pin
ThatsAlok9-May-12 21:13
ThatsAlok9-May-12 21:13 
AnswerRe: Drawimage Pin
Chris Meech9-May-12 2:49
Chris Meech9-May-12 2:49 
GeneralRe: Drawimage Pin
john56329-May-12 2:54
john56329-May-12 2:54 
GeneralRe: Drawimage Pin
Anu_Bala9-May-12 18:09
Anu_Bala9-May-12 18:09 
GeneralRe: Drawimage Pin
john56329-May-12 20:15
john56329-May-12 20:15 
AnswerRe: Drawimage Pin
wangafei9-May-12 21:03
wangafei9-May-12 21:03 
QuestionSplit window in MDI Pin
Anu_Bala8-May-12 19:21
Anu_Bala8-May-12 19:21 
Hi, I want 3 split windows in my application,in that left for Tree control and Right window act as a main window and bottom window have list control to show some log of my application. For that i made this code..
in Mainframe.cpp(), in OnCreateClient()

if(!m_SplitterWnd.CreateStatic(this, 2, 1))         
		return FALSE;     
	
	CRect rect;     
	GetClientRect(&rect); 

	if(!m_SplitterWnd.CreateView(1, 0, RUNTIME_CLASS(CBottomView), CSize(rect.Width(), 50),  pContext))        
		return FALSE;       

	m_SplitterWnd.SetRowInfo(0, 800, 50);
	m_SplitterWnd.SetRowInfo(1, 330, 50);

	if (!m_SplitterWnd1.CreateStatic(&m_SplitterWnd, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER |AFX_IDW_PANE_FIRST, m_SplitterWnd.IdFromRowCol(0,0)))     
	 	return FALSE;     
	       // first pane     

	if(!m_SplitterWnd1.CreateView(0, 0,  RUNTIME_CLASS(CTreeMenuView), CSize(rect.Width()/5,rect.Height()-50), pContext))	          
		return FALSE;      
	       //Second pane     
	
	if(!m_SplitterWnd1.CreateView(0, 1, RUNTIME_CLASS(CMainWindowView), CSize(rect.Width()-rect.Width()/5,rect.Height()-50), pContext))     
		return FALSE;  

		 	int nWidth=rect.Width();
	m_SplitterWnd1.SetColumnInfo(0, nWidth*0.25, 50);
	m_SplitterWnd1.SetColumnInfo(1, nWidth*0.75, 50);

	
	return CMDIFrameWnd::OnCreateClient(lpcs, pContext);


And i have to attach all my child window in right side window( CMainWindowView)..
In my app class,

pDocTemplate = new CMultiDocTemplate(IDR_MAINFRAME,
		RUNTIME_CLASS(CABBHarmonyDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CMainWindowView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);

	pGraphViewTemplate = new CMultiDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CABBHarmonyDoc),
		RUNTIME_CLASS(CChildFrame), 
		RUNTIME_CLASS(CGraphview));
	AddDocTemplate(pGraphViewTemplate);


So when i press F5,this GraphView should display in MainwindowView.
But it does not appear.Whats the mistake i did? Pls help me..

in Mianframe.cpp

void CMainFrame::OnGraphview()
{
		
 	if( pGraphDisplayFrame == NULL )
	{		
		CDocTemplate *pTemplate = theApp.pGraphViewTemplate;
		CABBHarmonyDoc* pDoc = new CABBHarmonyDoc;
		pGraphDisplayFrame = (CMDIChildWnd *)pTemplate->CreateNewFrame( pDoc ,NULL );
		if( pGraphDisplayFrame == NULL )
		{
			AfxMessageBox( "Unable to Create Graph Display" );
			return;
		}
		pTemplate->InitialUpdateFrame( pGraphDisplayFrame,NULL );
	}
	else
		MDIActivate( pGraphDisplayFrame );
	

}


When i debug, i found in winfrm.cpp,
void CFrameWnd::InitialUpdateFrame(CDocument* pDoc, BOOL bMakeVisible)
{
	// if the frame does not have an active view, set to first pane
	CView* pView = NULL;
	if (GetActiveView() == NULL)
	{
		CWnd* pWnd = GetDescendantWindow(AFX_IDW_PANE_FIRST, TRUE);		if (pWnd != NULL && pWnd->IsKindOf(RUNTIME_CLASS(CView)))
		{
			pView = (CView*)pWnd;
			SetActiveView(pView, FALSE);
		}
	}

Here pWnd returns NULL. Whats the mistake pls help me out.
Anu

AnswerRe: Split window in MDI Pin
Jochen Arndt8-May-12 21:04
professionalJochen Arndt8-May-12 21:04 
AnswerOdd MFC Dialog Executable Behavior Pin
wmallory8-May-12 8:20
wmallory8-May-12 8:20 
QuestionRe: Odd MFC Dialog Executable Behavior Pin
David Crow8-May-12 9:26
David Crow8-May-12 9:26 
GeneralRe: Odd MFC Dialog Executable Behavior Pin
Code-o-mat8-May-12 10:32
Code-o-mat8-May-12 10:32 
QuestionDiff of image Pin
john56328-May-12 1:06
john56328-May-12 1:06 
GeneralRe: Diff of image Pin
David Crow8-May-12 2:49
David Crow8-May-12 2:49 
QuestionSwitch To Another Doc Template Pin
002comp8-May-12 0:01
002comp8-May-12 0:01 
QuestionNeed help with my jump physics code Pin
Seeker20027-May-12 19:46
Seeker20027-May-12 19:46 
AnswerRe: Need help with my jump physics code Pin
Chuck O'Toole7-May-12 19:55
Chuck O'Toole7-May-12 19:55 
GeneralRe: Need help with my jump physics code Pin
Seeker20027-May-12 21:43
Seeker20027-May-12 21:43 
AnswerRe: Need help with my jump physics code Pin
CPallini8-May-12 0:03
mveCPallini8-May-12 0:03 
GeneralRe: Need help with my jump physics code Pin
Chuck O'Toole8-May-12 3:50
Chuck O'Toole8-May-12 3:50 
GeneralRe: Need help with my jump physics code Pin
CPallini8-May-12 3:52
mveCPallini8-May-12 3:52 
GeneralRe: Need help with my jump physics code Pin
Seeker20029-May-12 21:42
Seeker20029-May-12 21:42 
GeneralRe: Need help with my jump physics code Pin
CPallini9-May-12 21:55
mveCPallini9-May-12 21:55 
Questionallocating object in global storage Pin
ForNow7-May-12 15:21
ForNow7-May-12 15:21 
AnswerRe: allocating object in global storage Pin
Richard MacCutchan7-May-12 21:50
mveRichard MacCutchan7-May-12 21:50 

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.