单文档多视图中如何在MyTreeView中获得MyListView的指针? 在主框架窗口中为每个视添加一个指针成员变量。然后用((CMainFrame*)AfxGetApp()->m_pMainWnd)->...(指向你的视窗口的成员指针)就可以在任何地方引用你的视了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可我的View是在程序序中动态分割的呀!m_pMainWnd中没有视窗口的成员指针!我菜!能不能不用动态分割创建窗口! BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { // TODO: Add your specialized code here and/or call the base class CRect rect; GetClientRect(&rect); int width = rect.Width(); int height = rect.Height(); if (!m_wndSplitter.CreateStatic(this, 1, 2)) return FALSE; if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CInfoManagerView), CSize(width/3, height), pContext)) { TRACE0("Failed to create first pane\n"); return FALSE; } if (!m_wndSplitter2.CreateStatic( &m_wndSplitter, // our parent window is the first splitter 2, 1, // the new splitter is 2 rows, 1 column WS_CHILD | WS_VISIBLE , // style, WS_BORDER is needed m_wndSplitter.IdFromRowCol(0, 1) )) { TRACE0("Failed to create nested splitter\n"); return FALSE; } if (!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CInfoView), CSize(2*width/3, 2*height/3), pContext)) { TRACE0("Failed to create second pane\n"); return FALSE; } if (!m_wndSplitter3.CreateStatic( &m_wndSplitter2, // our parent window is the first splitter 1, 2, // the new splitter is 1 rows, 2 column WS_CHILD | WS_VISIBLE , // style, WS_BORDER is needed m_wndSplitter2.IdFromRowCol(1, 0) )) { TRACE0("Failed to create nested splitter\n"); return FALSE; } if (!m_wndSplitter3.CreateView(0, 0, RUNTIME_CLASS(CLetterView), CSize(85*width/100, height/3), pContext)) { TRACE0("Failed to create second pane\n"); return FALSE; } if (!m_wndSplitter3.CreateView(0, 1, RUNTIME_CLASS(CFileInfoView), CSize(15*width/100, height/3), pContext)) { TRACE0("Failed to create second pane\n"); return FALSE; } m_ManagerView = (CInfoManagerView *)m_wndSplitter.GetPane(0,0); m_InfoView = (CInfoView *)m_wndSplitter2.GetPane(0,0); m_LetterView = (CLetterView *)m_wndSplitter3.GetPane(0,0); m_FileInfoView = (CFileInfoView *)m_wndSplitter3.GetPane(0,1); ShowWindow(SW_SHOWMAXIMIZED); return TRUE;} 找到第一个指定类型的视图CView* CDoorCtrlApp::FindView(CRuntimeClass* pViewClass){ POSITION posDocTemplate=GetFirstDocTemplatePosition(); POSITION posDocument=NULL; POSITION posView=NULL; CDocTemplate* pDocTemplate=NULL; CDocument* pDocument=NULL; CView* pView=NULL; while(posDocTemplate){ pDocTemplate=GetNextDocTemplate(posDocTemplate); posDocument=pDocTemplate->GetFirstDocPosition(); while(posDocument){ pDocument=pDocTemplate->GetNextDoc(posDocument); posView=pDocument->GetFirstViewPosition(); while(posView){ pView=pDocument->GetNextView(posView); if(pView->IsKindOf(pViewClass)) return pView; } } } return NULL;} 控制台程序中调用对话框的问题 int 与 long转成_bstr_t的问题 自己写了一个源Filter,有个问题一直不知道怎么解决 录入文本的问题 如何在VC中调用VB的ACTIVE DLL?参数和结果为STRING类型? 哪位给我发个逆波兰运算源码 学过C++,想学VC,不知从何学起?还有看哪些书比较好?请指教!谢谢!! 关于Debug和Release(实在搞不定了,请高手指教) 简单的问题:如何对一个combobox进行初始化? 请问如何显示一个bmp图的二进制流? 请教各位一道数学题 怎样设置路径?
我菜!
能不能不用动态分割创建窗口!
{
// TODO: Add your specialized code here and/or call the base class
CRect rect;
GetClientRect(&rect);
int width = rect.Width();
int height = rect.Height(); if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE; if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CInfoManagerView), CSize(width/3, height), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
} if (!m_wndSplitter2.CreateStatic(
&m_wndSplitter, // our parent window is the first splitter
2, 1, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE , // style, WS_BORDER is needed
m_wndSplitter.IdFromRowCol(0, 1) ))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(0, 0,
RUNTIME_CLASS(CInfoView), CSize(2*width/3, 2*height/3), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
} if (!m_wndSplitter3.CreateStatic(
&m_wndSplitter2, // our parent window is the first splitter
1, 2, // the new splitter is 1 rows, 2 column
WS_CHILD | WS_VISIBLE , // style, WS_BORDER is needed
m_wndSplitter2.IdFromRowCol(1, 0) ))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndSplitter3.CreateView(0, 0,
RUNTIME_CLASS(CLetterView), CSize(85*width/100, height/3), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitter3.CreateView(0, 1,
RUNTIME_CLASS(CFileInfoView), CSize(15*width/100, height/3), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
m_ManagerView = (CInfoManagerView *)m_wndSplitter.GetPane(0,0);
m_InfoView = (CInfoView *)m_wndSplitter2.GetPane(0,0);
m_LetterView = (CLetterView *)m_wndSplitter3.GetPane(0,0);
m_FileInfoView = (CFileInfoView *)m_wndSplitter3.GetPane(0,1); ShowWindow(SW_SHOWMAXIMIZED); return TRUE;
}
CView* CDoorCtrlApp::FindView(CRuntimeClass* pViewClass)
{
POSITION posDocTemplate=GetFirstDocTemplatePosition();
POSITION posDocument=NULL;
POSITION posView=NULL;
CDocTemplate* pDocTemplate=NULL;
CDocument* pDocument=NULL;
CView* pView=NULL;
while(posDocTemplate){
pDocTemplate=GetNextDocTemplate(posDocTemplate);
posDocument=pDocTemplate->GetFirstDocPosition();
while(posDocument){
pDocument=pDocTemplate->GetNextDoc(posDocument);
posView=pDocument->GetFirstViewPosition();
while(posView){
pView=pDocument->GetNextView(posView);
if(pView->IsKindOf(pViewClass))
return pView;
}
}
}
return NULL;
}