我是点控制条的树形控件在C***App中用OpenDocumentFile()打开文件,但如果某个文件之前已经打开并显示了,怎样把对应窗口显示到最前面。
解决方案 »
- 请教有关VS 2005 运行的问题
- 我想要画一个界面,里面有上百个 Cstatic ,然后要根据不同情况给他们绘制背景颜色。请问有比较好的方法可以方便的操作这上百个CStatic?
- 在vc6 mfc下编写支持多国语言程序时遇到的问题
- 请问 difftime(t1,t2) 返回得值跟 t1-t2的结果有什么区别
- 请问如何设置Radio button在程序运行默认的选择?
- 等待键盘输入的问题,懂得人请进
- 拖动橡皮带线问题
- 请问各位高手,如何在VC下实现将某个线程绑定到多cpu的某个cpu上工作?(操作系统是win2k)
- 请问哪里有win2000 wdm 设计的书下载?
- 求助!
- 在对话框架类中获得视类指针,用自己定义静态函数,但出了个小问题,处男贴,急
- VC6.0安装问题--来捡分啊
CDocTemplate::GetFirstDocPosition/CDocTemplate::GetNextDoc遍历文档指针列表,
根据CDocument::GetPathName得到文件名称比较,找到了就用
CDocument::GetFirstViewPosition/CDocument::GetNextView找到视图激活。
这一步怎样激活视图到最前面?
{
int flag = 0;
POSITION p = pMyApp->GetFirstDocTemplatePosition();
while (p != NULL)
{
CDocTemplate *pDocTemplate = pMyApp->GetNextDocTemplate(p);
POSITION p1 = pDocTemplate->GetFirstDocPosition();
while (p1 != NULL)
{
CDocument *pDocument = pDocTemplate->GetNextDoc(p1);
POSITION p2 = pDocument->GetFirstViewPosition();
if(filename==pDocument->GetPathName())
{
while (p2 != NULL)
{
CView *pView = pDocument->GetNextView(p2);
flag = 1;
}
}
if(flag==0)
{m_pDocument->OpenDocumentFile(filename);}
}这是我按2楼的方法写的显示文件函数,现在文件已经打开过后并不再打开了。
大家指点下在哪里添加代码可以把找到的视图显示到最前端。
if(filename==pDocument->GetPathName())
{
POSITION p2 = pDocument->GetFirstViewPosition();
while (p2 != NULL)
{
CView *pView = pDocument->GetNextView(p2);
pView->GetParentFrame()->BringWindowToTop();
flag = 1;
break;
}
}