现在在编写一个编辑器,请问如何实现在一个编辑器实例已打开的情况下,在一个文件上右击鼠标打开时,能够在原实例中打开一个新的文档窗口。
解决方案 »
- 关于 一个图标 变化的问题
- PDF library
- 如何使抓图的尺寸与画的图尺寸一样大?
- 请教:OpenGL程序,总是有一个错误,这个错误提示是怎么回事啊?
- 如何在状态栏里画一个有颜色的方框??
- 高手进来:什么情况下CPropertyPage会收不到初始化的消息呢?
- 怎样创建一个类似无模式对话框的属性表?
- 求救!!!!!!!!!!!----关于资源问题
- 栈内存对齐问题
- OPENCV2.4.11+vs2015 Release生成问题
- 小弟刚刚开始学习VC,如何才能作一个可以编辑大于64k的sdi文本编辑器?
- 我在线等待 请大家帮帮忙我在线等待 请大家帮帮忙我在线等待 请大家帮帮忙我在线等待 请大家帮帮忙我在线等待 请大家帮帮忙我在线等待 请
BOOL OnOpenDocument( LPCTSTR lpszPathName );
将要打开的文件的绝对路径传给函数
BOOL CMyApp::InitInstance(){
// ..........
// ..........
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views. CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_SIMPLETYPE,
RUNTIME_CLASS(CSimplexDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CSimplexView));
AddDocTemplate(pDocTemplate); // create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame; // 允许支持文件拖放打开
m_pMainWnd->DragAcceptFiles(); // 允许通过 DDE 消息打开文件
EnableShellOpen();
RegisterShellFileTypes(TRUE); // 支持处理标准方法如 DDE, 打开命令等的命令行参数
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE; pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow(); return TRUE;
}然后系统应该就能支持你的要求了!