MFC如何获得RUNTIME_CLASS窗口句柄
如题,使用CSplitterWnd::CreatView()函数将窗口切割,在参数中使用到了一个RUNTIME_CLASS(viewclassname),如何获得这个vi...
如题,使用CSplitterWnd::CreatView()函数将窗口切割,在参数中使用到了一个
RUNTIME_CLASS(viewclassname),如何获得这个view子视图的句柄呢?
请高手不吝赐教,拜谢! 展开
RUNTIME_CLASS(viewclassname),如何获得这个view子视图的句柄呢?
请高手不吝赐教,拜谢! 展开
3个回答
展开全部
CSplitterWnd m_wndSplitter;
CSplitterWnd m_ChildSplitter;
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
{
if(!m_wndSplitter.CreateStatic(this,2,1))
{
TRACE0("分割行失败\n");
return false;
}
if (!m_ChildSplitter.CreateStatic(&m_wndSplitter,1,2,WS_CHILD|WS_VISIBLE,m_wndSplitter.IdFromRowCol(0,0)))
{
TRACE0("分割列失败\n");
return false;
}
m_ChildSplitter.CreateView(0,0,RUNTIME_CLASS(CLocalView),CSize(190,140),pContext);
m_ChildSplitter.CreateView(0,1,RUNTIME_CLASS(CFtpView),CSize(190,140),pContext);
m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CTastListView),CSize(0,10),pContext);
m_wndSplitter.SetRowInfo(0,365,50);
m_ChildSplitter.SetColumnInfo(0,400,50);
m_ChildSplitter.SetColumnInfo(1,400,50);
m_pFtpView=(CFtpView*)m_ChildSplitter.GetPane(0,1);
m_pLocalView=(CLocalView*)m_ChildSplitter.GetPane(0,0);
m_pTastView=(CTastListView*)m_wndSplitter.GetPane(1,0);
return true;
}
CSplitterWnd m_ChildSplitter;
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
{
if(!m_wndSplitter.CreateStatic(this,2,1))
{
TRACE0("分割行失败\n");
return false;
}
if (!m_ChildSplitter.CreateStatic(&m_wndSplitter,1,2,WS_CHILD|WS_VISIBLE,m_wndSplitter.IdFromRowCol(0,0)))
{
TRACE0("分割列失败\n");
return false;
}
m_ChildSplitter.CreateView(0,0,RUNTIME_CLASS(CLocalView),CSize(190,140),pContext);
m_ChildSplitter.CreateView(0,1,RUNTIME_CLASS(CFtpView),CSize(190,140),pContext);
m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CTastListView),CSize(0,10),pContext);
m_wndSplitter.SetRowInfo(0,365,50);
m_ChildSplitter.SetColumnInfo(0,400,50);
m_ChildSplitter.SetColumnInfo(1,400,50);
m_pFtpView=(CFtpView*)m_ChildSplitter.GetPane(0,1);
m_pLocalView=(CLocalView*)m_ChildSplitter.GetPane(0,0);
m_pTastView=(CTastListView*)m_wndSplitter.GetPane(1,0);
return true;
}
展开全部
CWnd* CSplitterWnd::GetPane(int row, int col)取得 CWnd指针
HWND CWnd::GetSafeHwnd() 取得句柄
HWND CWnd::GetSafeHwnd() 取得句柄
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
CSplitterWnd::GetPane得到,转为viewclassname类型就。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询