如何让自己的程序可以支持多种类型的文件? 1.VC++的打开对话框中的文件类型可以有多种,这是怎么实现的。在哪里可以添加支持的文件类型。2.还有怎么根据文件类型的不同,将内容正确显示出来。比如一种是.bmp,一种是.c。同理保存的时候怎么来有选择的做串行化。谢谢你的帮助,如能提供相关资料更好! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 add multiple doctemplate to your application in CxxxApp::InitInstance() m_pEditDocTemplate = new CMultiDocTemplate( IDR_dcmviewerTYPE, RUNTIME_CLASS(CdcmviewerDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CEditView)); AddDocTemplate(m_pEditDocTemplate); m_pHistDocTemplate = new CMultiDocTemplate( IDR_dcmviewerTYPE, RUNTIME_CLASS(CdcmviewerDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(HistogramView)); AddDocTemplate(m_pHistDocTemplate);CDocument* CxxxApp::OpenDocumentFile(LPCTSTR lpszFileName){ CDocument* pDoc = NULL; bool is_text_file = false; if(end_with(lpszFileName,_T(".txt"),true)|| end_with(lpszFileName,_T(".ini"),true) ) { pDoc = m_pEditDocTemplate->OpenDocumentFile(lpszFileName); is_text_file = true; } else pDoc = m_pImageDocTemplate->OpenDocumentFile(lpszFileName); ...} 在FORMVIEW中如何设置CStatic为透明背景? 大家爱给我出个注意,我该跳槽吗 wxWidgets中线程里使用wxSOCKET 关于msdn的问题 如何得到MP3文件的信息,声道数,品质等? 如何给ActiveX控件生成一个新的GUID? 请问,为何上次有人给我了80分,而我没看见可用分增加? 求助啊!关于控制台下 数据库CRecordset的操作方法,今天晚上在线 关闭对话框时,父窗口也关闭了 我现在写了一个C++的console程序,如何能改动最少的代码使console的输出显示在web上? 请教编译时找不到“windows.h”是什么原因
m_pEditDocTemplate = new CMultiDocTemplate(
IDR_dcmviewerTYPE,
RUNTIME_CLASS(CdcmviewerDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CEditView));
AddDocTemplate(m_pEditDocTemplate); m_pHistDocTemplate = new CMultiDocTemplate(
IDR_dcmviewerTYPE,
RUNTIME_CLASS(CdcmviewerDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(HistogramView));
AddDocTemplate(m_pHistDocTemplate);
CDocument* CxxxApp::OpenDocumentFile(LPCTSTR lpszFileName)
{
CDocument* pDoc = NULL;
bool is_text_file = false;
if(end_with(lpszFileName,_T(".txt"),true)|| end_with(lpszFileName,_T(".ini"),true)
)
{
pDoc = m_pEditDocTemplate->OpenDocumentFile(lpszFileName);
is_text_file = true;
}
else
pDoc = m_pImageDocTemplate->OpenDocumentFile(lpszFileName);
...
}