Click here to Skip to main content
15,905,875 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Please help me, why I cannot open the project? Pin
zhaopzhi9-Dec-03 17:45
zhaopzhi9-Dec-03 17:45 
GeneralCapture input of the CommandWindow Pin
Adi Narayana9-Dec-03 4:22
Adi Narayana9-Dec-03 4:22 
GeneralRe: Capture input of the CommandWindow Pin
JoeZhang9-Dec-03 18:00
JoeZhang9-Dec-03 18:00 
GeneralUDP Muticast Pin
suiram409-Dec-03 3:58
suiram409-Dec-03 3:58 
GeneralRe: UDP Muticast Pin
Alexander M.,9-Dec-03 4:50
Alexander M.,9-Dec-03 4:50 
GeneralRenameing Resource.h Pin
Prakash Nadar9-Dec-03 3:28
Prakash Nadar9-Dec-03 3:28 
GeneralRe: Renameing Resource.h Pin
Alexander M.,9-Dec-03 4:54
Alexander M.,9-Dec-03 4:54 
GeneralPlease Help with my Switching View Problem Pin
swerajan9-Dec-03 3:04
swerajan9-Dec-03 3:04 
I have a function written to switch views. I have created a menu item that has two sub menu. when the application is run the default dailog comes up. when i try to switch to the other view it is not working.
here is the code for switching the view.
void CMainFrame::SelectView(int viewID)
{

// CFrameWnd* pMainWnd = (CFrameWnd*)AfxGetMainWnd();
CView* pOldActiveView = GetActiveView(); // Get current view

// Get pointer to new view if it exists
// if it doesn't the pointer will be null
CView* pNewActiveView = (CView*) GetDlgItem(viewID);
// CView* pNewActiveView = static_cast<cview*>(GetDlgItem(viewID));

// If this is 1st time around for the new view,
// the new view won't exist, so we must create it
if (pNewActiveView == NULL)
{
switch(viewID)
{
case PEOPLEVIEW: // Create a People view
pNewActiveView = (CFormView*)new CPeople;
//pNewActiveView = (CView*)new CPeople;
break;
case RELATIONVIEW: // Create a Relationship view
pNewActiveView = (CView*)new CRelation;
//pNewActiveView = (CView*)new CRelation;
break;
default:
AfxMessageBox("Invalid View ID");
return;
}

// Switching the views
// Obtain the current view context to apply to the new view
CCreateContext context;
context.m_pCurrentDoc = pOldActiveView->GetDocument();
pNewActiveView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault,this, viewID, &context); // the program exits with an error at this point. please help me solve this
pNewActiveView->OnInitialUpdate();
}

// Check whether there are any orders


SetActiveView(pNewActiveView); // Activate the new view
pOldActiveView->ShowWindow(SW_HIDE); // Hide the old view
pNewActiveView->ShowWindow(SW_SHOW); // Show the new view
pOldActiveView->SetDlgCtrlID(m_CurrentViewID); // Set the old view ID
pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
m_CurrentViewID = viewID; // Save the new view ID
RecalcLayout();
}
GeneralRe: Please Help with my Switching View Problem Pin
Joel Lucsy9-Dec-03 3:25
Joel Lucsy9-Dec-03 3:25 
GeneralRe: Please Help with my Switching View Problem Pin
Michael P Butler9-Dec-03 3:27
Michael P Butler9-Dec-03 3:27 
GeneralBasic question on Pointers!! Pin
Ilamparithi9-Dec-03 2:35
Ilamparithi9-Dec-03 2:35 
GeneralRe: Basic question on Pointers!! Pin
Taka Muraoka9-Dec-03 2:46
Taka Muraoka9-Dec-03 2:46 
GeneralRe: Basic question on Pointers!! Pin
jmkhael9-Dec-03 2:46
jmkhael9-Dec-03 2:46 
GeneralCCombobox than Dropdown! Pin
Wholesaler9-Dec-03 1:57
Wholesaler9-Dec-03 1:57 
GeneralRe: CCombobox than Dropdown! Pin
Antti Keskinen9-Dec-03 2:39
Antti Keskinen9-Dec-03 2:39 
GeneralRe: CCombobox than Dropdown! Pin
Wholesaler9-Dec-03 2:49
Wholesaler9-Dec-03 2:49 
GeneralRe: CCombobox than Dropdown! Pin
RChin9-Dec-03 3:09
RChin9-Dec-03 3:09 
GeneralRe: CCombobox than Dropdown! Pin
Wholesaler9-Dec-03 3:17
Wholesaler9-Dec-03 3:17 
GeneralRe: CCombobox than Dropdown! Pin
RChin9-Dec-03 3:21
RChin9-Dec-03 3:21 
GeneralRe: CCombobox than Dropdown! Pin
Antti Keskinen9-Dec-03 3:14
Antti Keskinen9-Dec-03 3:14 
GeneralRe: CCombobox than Dropdown! Pin
Wholesaler9-Dec-03 3:24
Wholesaler9-Dec-03 3:24 
GeneralRe: CCombobox than Dropdown! Pin
Antti Keskinen10-Dec-03 2:48
Antti Keskinen10-Dec-03 2:48 
GeneralDDE and Netscape Pin
Monty29-Dec-03 1:55
Monty29-Dec-03 1:55 
GeneralRe: DDE and Netscape Pin
Antti Keskinen9-Dec-03 2:59
Antti Keskinen9-Dec-03 2:59 
Generalmultiple list control Pin
abdulsoni9-Dec-03 1:24
abdulsoni9-Dec-03 1:24 

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.