CDocument 成员函数: GetFirstViewPosition GetNextView可以得到所有视图CFrameWnd 成员函数: SetActiveView GetActiveView 取得活动视图 和 激活为活动视图 ================================================================ Country roads, take me home to the place I belong, West 0AVirginia, Mountain Mama. Take me home, country roads. ================================================================
GetFirstViewPosition
GetNextView可以得到所有视图CFrameWnd 成员函数:
SetActiveView
GetActiveView
取得活动视图 和 激活为活动视图
================================================================
Country roads, take me home to the place I belong, West
0AVirginia, Mountain Mama. Take me home, country roads.
================================================================
POSITION pos=GetFirstViewPosition();
while(pos)
{
CView* pView=GetNextView(pos);
if(pView满足条件)
{
CFrameWnd* pParentFrame=(CFrameWnd*)pView->GetParent();
pParentFrame->SetActiveView(pView);
}
}
POSITION pos=GetFirstViewPosition();
while(pos)
{
CView* pView=GetNextView(pos);
if(pView满足条件)
{
CFrameWnd* pParentFrame=(CFrameWnd*)pView->GetParent();
pParentFrame->SetActiveView(pView);
}
}
CString str;
HWND hWnd = ::GetWindow(AfxGetApp()->m_pMainWnd->m_hWnd,GW_HWNDFIRST);
//遍历所有窗口以找到子进程的主窗口
while(hWnd)
{
::GetWindowText(hWnd,lpSearch,128);
str.Format("%s",lpSearch);
if(str.Find(strWndText,0) >=0 )
{
// find all
}
else
hWnd = ::GetWindow(hWnd,GW_HWNDNEXT);
}
delete[] lpSearch;
p1 = pDocTemplate->GetFirstDocPosition();
if (p1 != NULL){
pDocument = pDocTemplate->GetNextDoc(p1);
POSITION p2;
p2 = pDocument->GetFirstViewPosition();
while(p2 != NULL){
i++;
pView = pDocument->GetNextView(p2);
}
itoa(i, temp, 10);
AfxMessageBox(temp);
}怎么总是1呢??
但是我用上面的程序总是得到1请大家在帮帮忙