Click here to Skip to main content
15,889,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to sync folders over the internet? Pin
Brian Delahunty14-Jun-03 0:30
Brian Delahunty14-Jun-03 0:30 
GeneralSearch Algorithims Pin
Steven M Hunt13-Jun-03 12:21
Steven M Hunt13-Jun-03 12:21 
GeneralRe: Search Algorithims Pin
Ryan Binns14-Jun-03 1:42
Ryan Binns14-Jun-03 1:42 
GeneralRe: Search Algorithims Pin
Steven M Hunt14-Jun-03 7:52
Steven M Hunt14-Jun-03 7:52 
GeneralProblem with CreateWindowEx(..)! Please Help! Pin
nutkase13-Jun-03 12:16
nutkase13-Jun-03 12:16 
GeneralChanging View of CFormView derived class at runtime Pin
JaisonCodeMan13-Jun-03 11:37
JaisonCodeMan13-Jun-03 11:37 
GeneralRe: Changing View of CFormView derived class at runtime Pin
abc87613-Jun-03 13:01
abc87613-Jun-03 13:01 
GeneralRe: Changing View of CFormView derived class at runtime Pin
abc87613-Jun-03 13:02
abc87613-Jun-03 13:02 
hi JaisonCodeMan!!
here is the code using which u can chnage the view dynamically. i am assuming that u want the same Docuemnt to be associated with all views.

<br />
<br />
#define FIRST_VIEW 1<br />
#define SECOND_VIEW 2<br />
#define THIRD_VIEW 3<br />
<br />
//CurrentviewID variable contain the currently slected view <br />
// initially it is set to FIRST_VIEW in cosntructor of<br />
// CMainFrame class like this <br />
// m_CurrentViewID=FIRST_VIEW;<br />
<br />
void SelectView(UINT ViewID)<br />
{<br />
	<br />
   CView* pOld=GetActiveView();<br />
  //Get pointer to new view if it exists<br />
  	<br />
   CView* pNew=(CView*) GetDlgItem(ViewID);<br />
  //if this is first time for the new view, we must create it<br />
	<br />
   if(pNew==NULL)<br />
   {<br />
	 switch(ViewID)<br />
	{<br />
	  case SECOND_VIEW:<br />
		pNew=(CView*) new CSecondViews;<br />
		break;<br />
			<br />
	  case THIRD_VIEW:<br />
		pNew=(CView*) new CThirdView;<br />
		break;<br />
	  default:<br />
			<br />
		AfxMessageBox("Invalid ID");<br />
	}<br />
		<br />
		<br />
		<br />
	//switching the view<br />
		<br />
	CCreateContext context;<br />
	context.m_pCurrentDoc=pOld->GetDocument();<br />
		<br />
	pNew->Create(NULL,NULL,0L,CFrameWnd::rectDefault,this,ViewID,&context);<br />
	pNew->OnInitialUpdate();<br />
		<br />
	}<br />
	<br />
	SetActiveView(pNew);<br />
	pOld->ShowWindow(SW_HIDE);<br />
	pNew->ShowWindow(SW_SHOW);<br />
	pOld->SetDlgCtrlID(m_CurrentViewID);<br />
	pNew->SetDlgCtrlID(AFX_IDW_PANE_FIRST);<br />
	m_CurrentViewID=ViewID;<br />
	<br />
	CDBase1Doc* pDoc=(CDBase1Doc*)GetActiveDocument ();<br />
	pDoc->AddView(pNew);<br />
	pDoc->RemoveView(pOld);<br />
	<br />
	RecalcLayout();<br />
}<br />


i hope this helps!!

cheers!! Wink | ;)



Muhammad Shoaib Khan
http://geocities.com/lansolution
GeneralRe: Changing View of CFormView derived class at runtime Pin
JaisonCodeMan16-Jun-03 20:32
JaisonCodeMan16-Jun-03 20:32 
GeneralRe: Changing View of CFormView derived class at runtime Pin
abc87621-Jun-03 10:22
abc87621-Jun-03 10:22 
Generaltitle Pin
aguest13-Jun-03 11:23
aguest13-Jun-03 11:23 
GeneralRe: title Pin
abc87613-Jun-03 11:39
abc87613-Jun-03 11:39 
GeneralRe: title Pin
adamUK14-Jun-03 11:53
adamUK14-Jun-03 11:53 
GeneralNetwork TCP conenction monitoring!! Pin
abc87613-Jun-03 11:21
abc87613-Jun-03 11:21 
General&amp; Pin
albean13-Jun-03 10:40
albean13-Jun-03 10:40 
GeneralRe: &amp; Pin
David Crow13-Jun-03 10:46
David Crow13-Jun-03 10:46 
GeneralRe: &amp; Pin
Michael Dunn13-Jun-03 14:29
sitebuilderMichael Dunn13-Jun-03 14:29 
GeneralRe: &amp; Pin
Atlantys13-Jun-03 19:05
Atlantys13-Jun-03 19:05 
GeneralDLL and CBitmap Pin
Bert Tuyt13-Jun-03 10:32
Bert Tuyt13-Jun-03 10:32 
GeneralRe: DLL and CBitmap Pin
gucy13-Jun-03 19:07
gucy13-Jun-03 19:07 
GeneralHelp with GUI Design in VC++ .NET Pin
James A Beggs13-Jun-03 10:31
James A Beggs13-Jun-03 10:31 
GeneralPostNcDestroy problems Pin
andyg.10113-Jun-03 10:24
andyg.10113-Jun-03 10:24 
GeneralRe: PostNcDestroy problems Pin
David Crow13-Jun-03 10:41
David Crow13-Jun-03 10:41 
GeneralRe: PostNcDestroy problems Pin
John M. Drescher13-Jun-03 10:46
John M. Drescher13-Jun-03 10:46 
GeneralRe: PostNcDestroy problems Pin
andyg.10113-Jun-03 10:51
andyg.10113-Jun-03 10:51 

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.