Пример #1
0
void CKmlDlg::OnBnClickedBplayer()
{
	CString fileName;

	CFileDialog dlgFile(true, _T("*.txt"), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, _T("*.txt|*.txt||"), this);

//	dlgFile.GetOFN().lpstrFile = fileName.GetBuffer(MyMaxPath);
//	dlgFile.GetOFN().nMaxFile = MyMaxPath;	
	INT_PTR nResult = dlgFile.DoModal();
//	fileName.ReleaseBuffer();

	if(nResult != IDOK)
	{
		return;
	}
	fileName = dlgFile.GetPathName();

	m_directory.SetWindowText(fileName);
	sPath = Utility::GetFilePath(fileName) + "\\";

	for(int i=0;i<NumOfCheckBox;i++)
	{
		m_check[i].SetCheck(0);
	}

	int s = m_selectall.GetCheck();
	if(m_selectall.GetCheck() == BST_UNCHECKED)
		GetDatFile();
	else if(m_selectall.GetCheck() == BST_CHECKED)
		GetAllDatFile();

	NoOfFile = 0;
	m_hselectall.SetCheck(BST_CHECKED);
}
void CEagleViewImport::OnBnClickedBrowsebtn()
{

#define MAX_CFileDialog_FILE_COUNT 99

#define FILE_LIST_BUFFER_SIZE ((MAX_CFileDialog_FILE_COUNT * (MAX_PATH + 1)) + 1)

	CString fileName;
	int i = 0;
	wchar_t* p = fileName.GetBuffer(FILE_LIST_BUFFER_SIZE);
	CFileDialog dlgFile(TRUE);
	OPENFILENAME& ofn = dlgFile.GetOFN();
	ofn.Flags |= OFN_READONLY;
	ofn.lpstrFile = p;
	int nRet2 = (int)ShellExecute(P_WAIT, L"open", L"cmd.exe", L"/c Del .\\test.txt", L".\\", SW_NORMAL);
	int nRet3 = (int)ShellExecute(P_WAIT, L"open", L"cmd.exe", L"/c Del .\\output.txt", L".\\", SW_NORMAL);
	dlgFile.DoModal();
	
	
	

	ImportEagleView(ofn.lpstrFile, NULL, true);


	//ImportEagleView("", NULL, true);

}
Пример #3
0
void AssignSound()
{
  CString strBasePath = ValueForKey(g_qeglobals.d_project_entity, "basepath");
  AddSlash(strBasePath);
  CString strPath = strBasePath;
  strPath += "sound\\";

  CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Sound files (*.wav,*.mp3)|*.wav;*.mp3||", g_pParentWnd);
  dlgFile.m_ofn.lpstrInitialDir = strPath;
  if (dlgFile.DoModal() == IDOK)
  {
	  SendMessage(hwndEnt[EntKeyField], WM_SETTEXT, 0, (LPARAM)"noise");	
    CString str = dlgFile.GetPathName().GetBuffer(0);
    str.MakeLower();
    strBasePath.MakeLower();
    QE_ConvertDOSToUnixName(str.GetBuffer(0), str.GetBuffer(0));
    QE_ConvertDOSToUnixName(strBasePath.GetBuffer(0), strBasePath.GetBuffer(0));
    int n = str.Find(strBasePath);
    if (n == 0)
    {
      str = str.Right(str.GetLength() - strBasePath.GetLength());
    }

	  SendMessage(hwndEnt[EntValueField], WM_SETTEXT, 0, (LPARAM)str.GetBuffer(0));	
    AddProp();
    g_pParentWnd->GetXYWnd()->SetFocus();
  }
}
Пример #4
0
void CEnrollDlg::OnBnClickedImportModels()
{
	// TODO: 在此添加控件通知处理程序代码
	CFileDialog dlgFile(TRUE, "frmodel", 0, OFN_NOCHANGEDIR | OFN_HIDEREADONLY, 
		"人脸模板文件 (*.frmodel)|*.frmodel||");
	if (dlgFile.DoModal() == IDOK)
	{
		CString path = dlgFile.GetPathName();
		setlocale(LC_ALL, "Chinese-simplified"); //设置中文环境
		ifstream is(path, ios::binary);
		if (!is)
		{
			::AfxMessageBox(path+" : 无法读取。");
			return;
		}

		int readNum = g_faceMngr->ReadModelFromFile(is);
		CString msg;
		msg.Format("共导入%d个模板,现有%d个模板。\n请注意模板和子空间降维矩阵的对应。", 
			readNum, g_faceMngr->GetModelCount());
		::AfxMessageBox(msg, MB_OK | MB_ICONINFORMATION);

		is.close();
		setlocale(LC_ALL, "C");// 还原

		if (m_nShootNum == 0) OnBnClickedCancel();
	}
}
Пример #5
0
// int CVideoPlayBack::DownLoadStramCB(struct _jcu_stream_cb_s *handle, jcu_cb_parm_t *parm)
// {
// 	//TRACE("======================id %d, args %d, size %d data %x\n", parm->id, parm->args, parm->size, parm->data);
// 
// 	j_frame_t* pBufFrame = (j_frame_t*)parm->data;
// 	if (parm->id == JCU_STREAM_EV_OPEN)
// 	{
// 		return 0;
// 	}
// 	else if (parm->id == JCU_STREAM_EV_RECV)
// 	{
// 
// 		if(gVideoPlayback->m_lstartTime < 0 && (pBufFrame->frame_type == j_video_i_frame || pBufFrame->frame_type == j_video_p_frame || pBufFrame->frame_type == j_video_b_frame))
// 		{
// 			gVideoPlayback->m_lstartTime = pBufFrame->timestamp_sec;
// 		}
// 		;
// 		int iRet = -1;
// 		iRet = fwrite(parm->data,parm->size,1,fp);
// 		if( iRet != 1)
// 		{
// 			//AfxMessageBox("写入信息失败");
// 			return -1;
// 		}
// 		//TRACE("写入成功");
// 		long fileSize = ftell(fp);  //文件大小
// 		g_PubData.g_iDownLoadPos = fileSize /  (gVideoPlayback->m_lRecFileSize[gVideoPlayback->m_iListIndex] / 100);
// 		if(pBufFrame->frame_type == j_video_i_frame || pBufFrame->frame_type == j_video_p_frame || pBufFrame->frame_type == j_video_b_frame)
// 		{
// 			gVideoPlayback->m_lEndTime = pBufFrame->timestamp_sec;
// 		}
// 		gVideoPlayback->m_lFrameCount ++;
// 		return 0;
// 	}
// 	else if(parm->id == JCU_STREAM_EV_CLOSE)
// 	{
// 		if(m_downloadHandle == NULL)
// 			return -1;
// 		//TRACE("下载完成\n");
// 
// // 		STFileHead_1000 fileHead;   //文件头信息
// // 		STFileIndex_1001 fileIndex;	//文件索引信息
// // 
// // 		fileHead.m_dwMagic = READER_T_JPF;
// // 		fileHead.m_dwVersion = 0x01000002;
// // 		fileHead.m_lTimeZone = 0;
// // 		fileHead.m_iFileOffset = sizeof(stFileIndex_1001);
// // 		fileHead.m_iUserOffset = 0;
// // 
// // 		// 		m_lFrameCount	= 0;				// 帧数
// // 		// 		m_iRes1			= 0;				// 保留位
// // 		// 		m_tStart		= 0;				// 开始时间
// // 		// 		m_tEnd			= 0;				// 结束时间
// // 		// 		m_dwSize		= 0xFFFFFFFF;		// 下一索引位置
// // 		// 		m_dwProtocal	= READER_T_JPF;		// 协议类型,如:READER_T_JPF
// // 		// 		m_dwEncoder		= Encoder_3516;		// 创建的主机的CPU,见eEncoderType
// // 		// 		m_iRes2			= 0;				// 保留位
// // 		long fileSize = ftell(fp);
// // 		fileIndex.m_lFrameCount = gVideoPlayback->m_lFrameCount;
// // 		fileIndex.m_iRes1 = 0;
// // 		fileIndex.m_tStart = gVideoPlayback->m_lstartTime;
// // 		fileIndex.m_tEnd = gVideoPlayback->m_lEndTime;
// // 		fileIndex.m_dwSize = fileSize;
// // 		fileIndex.m_dwProtocal = READER_T_JPF;
// // 		fileIndex.m_dwEncoder = Encoder_3516;
// // 		fileIndex.m_iRes2 = 0;
// // 
// // 		fseek(fp, 0L , 0);
// // 		int iRet = -1;
// // 		iRet = fwrite((char *)&fileHead, sizeof(fileHead),1,fp);
// // 		if(iRet != 1)
// // 		{
// // 			//AfxMessageBox(_T("写入文件头失败"));
// // 			return 0;
// // 		}
// // 
// // 		iRet = fwrite((char *)&fileIndex, sizeof(fileIndex),1,fp);
// // 		if(iRet != 1)
// // 		{
// // 			//AfxMessageBox(_T("写入文件索引位置信息失败"));
// // 			return 0;
// // 		}
// // 
// // 		fclose(fp);
// // 		fp = NULL;
// // 
// // 		if(m_downloadHandle != NULL)
// // 		{
// // 			iRet = jcu_net_rec_close(m_downloadHandle);
// // 			if(iRet != 0)
// // 			{
// // 				//AfxMessageBox(_T("关闭录像失败"));
// // 				return -1;
// // 			}
// // 			m_downloadHandle = NULL;
// // 		}
// // 		
// 
// 		gVideoPlayback->m_progressDownLoad.SetPos(100);
// 		g_PubData.g_iDownLoadPos = 0;
// 		gVideoPlayback->GetDlgItem(IDC_BUTTON_SERACHVIDEO)->EnableWindow(TRUE);
// 		gVideoPlayback->GetDlgItem(IDC_BUTTON_DOWNLOAD)->EnableWindow(TRUE);
// 		if(g_PubData.g_iLanguageFlag == 0)
// 			AfxMessageBox(_T("下载完成"));
// 		else
// 			AfxMessageBox(_T("Download"), _T("Download success!"));
// 		gVideoPlayback->m_progressDownLoad.SetPos(0);
// 		gVideoPlayback->m_progressDownLoad.ShowWindow(SW_HIDE);
// 		return 0;
// 	}
// 	return 0;	
// 	
// }
// int CVideoPlayBack::DownLoadNotifyCB(struct _jcu_notify_cb_s *handle, jcu_cb_parm_t *parm)
// {
// 	gVideoPlayback->m_nDownLoadFlag = parm->args;
// 	if (parm->args != JCU_NOTIFY_ERR_0)
// 	{
// 		if(m_downloadHandle != NULL)
// 		{
// 			int iRet = jcu_net_rec_close(m_downloadHandle);
// 			if(iRet != 0)
// 			{
// 				return -1;
// 			}
// 			m_downloadHandle = NULL;
// 		}
// 		g_PubData.g_iDownLoadPos = 0;
// 		gVideoPlayback->GetDlgItem(IDC_BUTTON_SERACHVIDEO)->EnableWindow(TRUE);
// 		gVideoPlayback->GetDlgItem(IDC_BUTTON_DOWNLOAD)->EnableWindow(TRUE);
// 		gVideoPlayback->m_progressDownLoad.SetPos(0);
// 		gVideoPlayback->m_progressDownLoad.ShowWindow(SW_HIDE);
// 		AfxMessageBox(_T("Download"), _T("Download error!"));
// 		return -1;
// 	}
// 	return 0;
// }
void CVideoPlayBack::OnBnClickedButtonPlayfile()
{
	// TODO: 在此添加控件通知处理程序代码
	

	CString		strFile		= "";
	CString		strText		= "";
	time_t		tStart		= 0;		// 文件的开始时间
	time_t		tEnd		= 0;		// 文件的结束时间
	long		lSize		= 0;		// 文件的大小
	long		lProtocal	= 0;		// 文件的帧头协议
	long		lEncoder	= 0;		// 文件所用的编码器
	CFileDialog dlgFile(TRUE, _T("jav"),NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
		_T("jav Files (*.jav)|*.jav|All Files (*.*)|*.*||"),this);

	if ( dlgFile.DoModal()!=IDOK )
	{
		return;
	}
	strFile	= dlgFile.GetPathName(); 

	PlayVideoFile(strFile);

	
}
void CPrintFooterDataDlg::OnFooterCbitmapSelBtn() 
{
	CFileDialog dlgFile(TRUE);
    CString strFileName;
	CString strFilter;
	CString strTitle;

	VERIFY(strTitle.LoadString(AFX_IDS_OPENFILE));

	// append the "*.*" all files filter
	CString strFilterTmp;
	VERIFY(strFilterTmp.LoadString(IDS_BMPFILTER));
	strFilter += strFilterTmp;
	strFilter += (TCHAR)'\0';   // next string please
	strFilter += _T("*.bmp");
	strFilter += (TCHAR)'\0';   // last string
	dlgFile.m_ofn.nMaxCustFilter++;

    dlgFile.m_ofn.lpstrFilter = strFilter;
    dlgFile.m_ofn.lpstrTitle = strTitle;

    if(dlgFile.DoModal() == IDOK)
    {
        CWnd*   pWnd = GetDlgItem(IDC_FOOTER_CBITMAP_EDIT);
        m_strBitmap = dlgFile.m_ofn.lpstrFile;
        pWnd->SetWindowText(m_strBitmap);
    }
}
Пример #7
0
void CTrainDlg::OnBnClickedImportMat()
{
	// TODO: 在此添加控件通知处理程序代码
	CFileDialog dlgFile(TRUE, "frmat", "test", 
		OFN_NOCHANGEDIR | OFN_HIDEREADONLY, 
		"人脸识别矩阵文件 (*.frmat)|*.frmat||");
	if (dlgFile.DoModal() == IDOK)
	{
		CString path = dlgFile.GetPathName();
		setlocale(LC_ALL, "Chinese-simplified"); //设置中文环境
		ifstream is(path, ios::binary);
		if (!is)
		{
			::AfxMessageBox(CString(path)+":无法读取。");
			return;
		}

		if (g_faceMngr->ReadMatFromFile(is))
			::AfxMessageBox("导入完成。\n请注意模板和子空间降维矩阵的对应。", MB_OK | MB_ICONINFORMATION);

		is.close();
		setlocale(LC_ALL, "C");// 还原
	}
	OnCancel();
}
Пример #8
0
/**< ContextMenu save image */
void ImagePanel::OnCmenuSave(wxCommandEvent& event)
{
	static const wxString EXTS[] =
	{
		_T("bmp"),
		_T("jpg"),
		_T("png"),
		_T("tif")
	};
	// choose images file's name
	wxFileDialog dlgFile(this, _("Save Image"),
	                     _T(""), _T(""),
	                     _T("Bitmap|*.bmp|JPEG|*.jpg;*.jpeg|PNG|*.png|TIFF|*.tif;*.tiff"),
	                     wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
	dlgFile.SetFilterIndex(2);	// png
	if(dlgFile.ShowModal() != wxID_OK)
		return;
	// extention
	int iExt = dlgFile.GetFilterIndex();
	// path modify
	wxFileName fln(dlgFile.GetPath());
	fln.ClearExt();
	fln.SetExt(EXTS[iExt]);
	wxString strFile = fln.GetFullPath();
	m_img.SaveFile(strFile);
}
Пример #9
0
//Авторские права - VTOOLS.RU ([email protected])
// ReportManager.cpp: implementation of the CReportManager class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ReportManager.h"
#include "Compiler\ChooseValue.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CReportManager::CReportManager()
{
	csTitle="Выбор";
	bSmall=FALSE;
}
 
CReportManager::~CReportManager()
{

}

void CReportManager::OnFileNew()
{
	CChooseValue dlg;
	CArray <CDocTemplate*,CDocTemplate*> listTemlate;
	POSITION pos=GetFirstDocTemplatePosition();
	for(int i=0;i<aDescription.GetSize();i++)
	{
		CDocTemplate* pTemplate=GetNextDocTemplate(pos);
		if(aDescription[i].bCanVisible)
		{
			dlg.List.Add(aDescription[i].csDescription);
			dlg.ListImage.Add(aDescription[i].nImage);
			listTemlate.Add(pTemplate);
		}
	}

	dlg.nStart=0;
	dlg.csTitle=csTitle;
	dlg.nMode=0;
	if(bSmall)
		dlg.Small();

	int nResponse = IDOK;
	int nIndex=0;
	if(dlg.List.GetSize()>1)
	{
		nResponse = dlg.DoModal();
		nIndex=dlg.nRes;
	}
	if (nResponse == IDOK)
	{
		if(listTemlate.GetSize()>0)
		if(listTemlate[nIndex])
			listTemlate[nIndex]->OpenDocumentFile(NULL);
	}
}
void CReportManager::AddDocTemplate(CMultiDocTemplate *p,CString csName,CString csDescription,bool bCanView,int nImage)
{
	CDocManager::AddDocTemplate(p);
	csName.TrimLeft();
	csName.TrimRight();
	
	CReportElement data;
	data.csName=csName;
	data.csDescription=csDescription;
	data.bCanVisible=bCanView;
	data.nImage=nImage;

	aDescription.Add(data);
}

CDocument* CReportManager::OpenForm(CString csName,BOOL bVisible)
{
	if(!AfxGetMainWnd())
		return 0;

	POSITION pos=GetFirstDocTemplatePosition();
	CString csFind=mUpper(csName);
	CDocTemplate* pTemplate=NULL;
	BOOL bFind=FALSE;
	for(int i=0;i<aDescription.GetSize();i++)
	{
		pTemplate=GetNextDocTemplate(pos);

		CString csCurName=aDescription[i].csName;
		if(csFind==mUpper(csCurName))
		{
			bFind=TRUE;
			break;
		}
	}
	if(bFind)
	{
		if(pTemplate)
		{
			CDocument* pDoc=pTemplate->OpenDocumentFile(NULL,bVisible);
			((CEnterpriseApp*)AfxGetApp())->DeleteConfigName();
			return pDoc;
		}
	}
	return NULL;
}
void AFXAPI _AfxAppendFilterSuffix(CString& filter, OPENFILENAME& ofn,
	CDocTemplate* pTemplate, CString* pstrDefaultExt)
{
	ASSERT_VALID(pTemplate);
	ASSERT_KINDOF(CDocTemplate, pTemplate);

	CString strFilterExt, strFilterName;
	if (pTemplate->GetDocString(strFilterExt, CDocTemplate::filterExt) &&
	 !strFilterExt.IsEmpty() &&
	 pTemplate->GetDocString(strFilterName, CDocTemplate::filterName) &&
	 !strFilterName.IsEmpty())
	{
		// a file based document template - add to filter list
		ASSERT(strFilterExt[0] == '.');
		if (pstrDefaultExt != NULL)
		{
			// set the default extension
			*pstrDefaultExt = ((LPCTSTR)strFilterExt) + 1;  // skip the '.'
			ofn.lpstrDefExt = (LPTSTR)(LPCTSTR)(*pstrDefaultExt);
			ofn.nFilterIndex = ofn.nMaxCustFilter + 1;  // 1 based number
		}

		// add to filter
		filter += strFilterName;
		ASSERT(!filter.IsEmpty());  // must have a file type name
		filter += (TCHAR)'\0';  // next string please
		filter += (TCHAR)'*';
		filter += strFilterExt;
		filter += (TCHAR)'\0';  // next string please
		ofn.nMaxCustFilter++;
	}
}
//*/
BOOL CReportManager::DoPromptFileName(CString& fileName, UINT nIDSTitle, DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate)
{
	CFileDialog dlgFile(bOpenFileDialog);

	CString title;
	VERIFY(title.LoadString(nIDSTitle));

	dlgFile.m_ofn.Flags |= lFlags;

	CString strFilter;
	CString strDefault;
	if (pTemplate != NULL)
	{
		ASSERT_VALID(pTemplate);
		_AfxAppendFilterSuffix(strFilter, dlgFile.m_ofn, pTemplate, &strDefault);
	}
	else
	{
		// do for all doc template
		POSITION pos = m_templateList.GetHeadPosition();
		BOOL bFirst = TRUE;
		while (pos != NULL)
		{
			CDocTemplate* pTemplate = (CDocTemplate*)m_templateList.GetNext(pos);
			_AfxAppendFilterSuffix(strFilter, dlgFile.m_ofn, pTemplate,
				bFirst ? &strDefault : NULL);
			bFirst = FALSE;
		}
	}

	CString allFilter;

	// append the "*.html" files filter
	if(mUpper(strDefault)=="2C")
	{
		allFilter="Файлы HTML (*.htm)";
		strFilter += allFilter;
		strFilter += (TCHAR)'\0';   // next string please
		strFilter += _T("*.htm");
		strFilter += (TCHAR)'\0';   // last string
		dlgFile.m_ofn.nMaxCustFilter++;
	}

	// append the "*.*" all files filter
	VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
	strFilter += allFilter;
	strFilter += (TCHAR)'\0';   // next string please
	strFilter += _T("*.*");
	strFilter += (TCHAR)'\0';   // last string
	dlgFile.m_ofn.nMaxCustFilter++;


	dlgFile.m_ofn.lpstrFilter = strFilter;
	dlgFile.m_ofn.lpstrTitle = title;
	dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH);

	int nResult = dlgFile.DoModal();
	fileName.ReleaseBuffer();
	return nResult == IDOK;
}
void CDlgParamEditFile::OnBnClickedButtonFile()
{
	// TODO: 在此添加控件通知处理程序代码
	CFileDialog dlgFile(TRUE
		, NULL
		, NULL
		, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT
		, "All Files (*.*)|*.*||"
		//, AfxGetMainWnd()
		);

	CString strFilePath;

	if (dlgFile.DoModal() == IDOK)
	{
		strFilePath = dlgFile.GetPathName();
		if (!strFilePath.IsEmpty() && !PathFileExists(strFilePath))
		{
			CString sMsg;
			sMsg.Format("文件 %s 不存在", strFilePath);
			MessageBox(sMsg, g_lpszAppTitle, MB_OK|MB_ICONINFORMATION);
		}
		else
		{
			GetDlgItem(IDC_EDIT)->SetWindowText(strFilePath);
		}
	}
}
Пример #11
0
void CKmlDlg::OnBnClickedBplayer()
{
	CString fileName;
	CFileDialog dlgFile(true, _T("*.txt"), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, _T("*.txt|*.txt||"), this);

	INT_PTR nResult = dlgFile.DoModal();
	if(nResult != IDOK)
	{
		return;
	}
  
	fileName = dlgFile.GetPathName();
	m_directory.SetWindowText(fileName);
	sPath = Utility::GetFilePath(fileName) + "\\";
	for(int i = 0; i < NumOfCheckBox; ++i)
	{
		m_check[i].SetCheck(BST_UNCHECKED);
	}

  GetDataFiles(m_selectall.GetCheck() == BST_CHECKED);
	//NoOfFile = 0;
  if(KML_USE_CHECKLISTBOX)
  {
    ((CButton*)GetDlgItem(IDC_CHECK_ALL))->SetCheck(BST_CHECKED);
  }
  else
  {
    m_hselectall.SetCheck(BST_CHECKED);
  }
}
Пример #12
0
BOOL CDxtexDoc::PromptForBmp(CString* pstrPath)
{
    CFileDialog dlgFile(TRUE);

    CString title;
    VERIFY(title.LoadString(AFX_IDS_OPENFILE));

    CString strFilter;
    CString strDefault;

    strFilter += "Image Files (*.dds, *.hdr, *.bmp, *.tga, *.jpg, *.png, *.dib)";
    strFilter += (TCHAR)'\0';   // next string please
    strFilter += _T("*.dds;*.hdr;*.bmp;*.tga;*.jpg;*.png;*.dib");
    strFilter += (TCHAR)'\0';   // last string
    dlgFile.m_ofn.nMaxCustFilter++;

    // append the "*.*" all files filter
    CString allFilter;
    VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
    strFilter += allFilter;
    strFilter += (TCHAR)'\0';   // next string please
    strFilter += _T("*.*");
    strFilter += (TCHAR)'\0';   // last string
    dlgFile.m_ofn.nMaxCustFilter++;

    dlgFile.m_ofn.lpstrFilter = strFilter;
    dlgFile.m_ofn.lpstrTitle = title;
    dlgFile.m_ofn.lpstrFile = pstrPath->GetBuffer(_MAX_PATH);

    INT_PTR nResult = dlgFile.DoModal();
    pstrPath->ReleaseBuffer();
    if (nResult != IDOK)
        return FALSE;
    return TRUE;
}
Пример #13
0
BOOL AfxDoPromptFileName(CString& fileName, UINT nIDSTitle, DWORD lFlags, BOOL bOpenFileDialog )
{
	CKSFileDialog dlgFile(bOpenFileDialog);

	CString title;
	VERIFY(title.LoadString(nIDSTitle));

	dlgFile.m_ofn.Flags |= lFlags;
	
	CString strFilter;
	CString strDefault;
	
	_AfxAppendFilterSuffix(strFilter, dlgFile.m_ofn,&strDefault);

	// append the "*.*" all files filter
	CString allFilter;
	VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
	strFilter += allFilter;
	strFilter += (TCHAR)'\0';   // next string please
	strFilter += _T("*.*");
	strFilter += (TCHAR)'\0';   // last string
	dlgFile.m_ofn.nMaxCustFilter++;

	dlgFile.m_ofn.lpstrFilter = strFilter;
	dlgFile.m_ofn.lpstrTitle = title;
	dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH);

	int nResult = dlgFile.DoModal();
	fileName.ReleaseBuffer();
	CString	strPath = dlgFile.GetPathName( );
	return nResult == IDOK;
}
Пример #14
0
void CDlgConfigDisk::OnBtnBrowse1() 
{
	CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "DSK Files (*.dsk;*.do;*.po;*.nib;*.2mg;*.2img)|*.dsk;*.do;*.po;*.nib;*.2mg;*.2img|All Files (*.*)|*.*||");

	if (dlgFile.DoModal() == IDOK)
	{
		CString oldStr = m_strDisk1Image;
		m_strDisk1Image = dlgFile.GetPathName();
		UpdateData(FALSE);
	}
}
Пример #15
0
void CDlgAutoRegister::OnBnClickedBtnSelect()
{
	CFileDialog    dlgFile(TRUE, m_strFilePath, m_strFilePath, OFN_HIDEREADONLY, _T("身份证列表文件 (*.txt)|*.txt|All Files (*.*)|*.*||"), NULL);


	if (IDOK == dlgFile.DoModal())
	{
		m_strFilePath = dlgFile.GetPathName();
		UpdateData(FALSE);
	}
}
Пример #16
0
void CMediaPlayerDlg::OnButtonSetMediadir()
{

    CFileDialog dlgFile(TRUE);
    CString title;
    CString strFilter, strDefault, strFilename;

    VERIFY(title.LoadString(AFX_IDS_OPENFILE));

    // Initialize the file extensions and descriptions
    strFilter += "Media Files (*.avi, *.mpg, *.wav, *.mid, *.mpeg)\0";
    strFilter += (TCHAR)'\0';
    strFilter += _T("*.avi;*.mpg;*.wav;*.mid;*.mpeg\0");
    strFilter += (TCHAR)'\0';
    dlgFile.m_ofn.nMaxCustFilter++;

    CString allFilter;
    VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));

    // Append the "*.*" all files filter
    strFilter += allFilter;
    strFilter += (TCHAR)'\0';     // next string
    strFilter += _T("*.*\0");
    strFilter += (TCHAR)'\0\0';   // last string
    dlgFile.m_ofn.nMaxCustFilter++;

    dlgFile.m_ofn.lpstrFilter = strFilter;
    dlgFile.m_ofn.lpstrTitle  = title;
    dlgFile.m_ofn.lpstrFile   = strFilename.GetBuffer(_MAX_PATH);

    // Display the file open dialog
    INT_PTR nResult = dlgFile.DoModal();

    // If a file was selected, update the main dialog
    if (nResult == IDOK)
    {
        m_MPEditMediaDir.SetWindowText(strFilename);

        // Render this file and show the first video frame, if present
        OnSelectFile();
    }

    strFilename.ReleaseBuffer();

    m_MPCheckFullScreen.EnableWindow(true);
    // Don't bother with full-screen for audio-only files
    if ((g_bAudioOnly_MP) || (!pVW_MP))
    {
        m_MPCheckFullScreen.EnableWindow(false);
        return;
    }


}
Пример #17
0
//实现成员函数
//打开文件以及返回文件的成员方法的实现
CString CMusicPlayer::BootOpenDialog(void)
{
	CString strFile = _T("");

    CFileDialog    dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("Music Files (*.wav)|*.wav|All Files (*.*)|*.*||"), NULL);
    if (dlgFile.DoModal())
    {
        strFile = dlgFile.GetPathName();//获取文件路径getpathname()
    }
    return strFile;
}
Пример #18
0
void CPPgFiles::BrowseVideoplayer()
{
	CString strPlayerPath;
	GetDlgItemText(IDC_VIDEOPLAYER, strPlayerPath);
	CFileDialog dlgFile(TRUE, _T("exe"), strPlayerPath, OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY, _T("Executable (*.exe)|*.exe||"), NULL, 0);
	if (dlgFile.DoModal() == IDOK)
	{
		GetDlgItem(IDC_VIDEOPLAYER)->SetWindowText(dlgFile.GetPathName());
		SetModified();
	}
}
Пример #19
0
CString COrPSFDlg::BootOpenDialog()
{
    CString strFile = _T("");

    CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("All Files (*.*)||"), NULL);

    if (dlgFile.DoModal())
    {
        strFile = dlgFile.GetPathName();
    }

    return strFile;
}
void ProjectConfigChildDLG::OnBnClickedButton2()
{
	// TODO: 在此添加控件通知处理程序代码
	CFileDialog dlgFile(TRUE,_T("*.dll"),NULL,OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,
		_T("动态链接库(*.dll)|*.dll|All Files(*.*)|*.*||"),NULL);
	if(dlgFile.DoModal()!=IDOK)
		return;

	//得到的是模拟方法dll文件的路径
	CString filePath=dlgFile.GetPathName();
	m_EDIT2.SetWindowText(filePath);
	simulatePath=filePath;
}
Пример #21
0
void CID3v2Page3::OnButtonSelect() 
{
	CFileDialog dlgFile( TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Bitmap (*.bmp)|*.bmp" );
	
	CString strTitle = theApp.LoadTranslatedString( "IdsChoosePicture" );
	dlgFile.m_ofn.lpstrTitle = strTitle;
	dlgFile.m_ofn.lpstrInitialDir = ".\\";
	if( dlgFile.DoModal() == IDOK )
	{
		LoadPicture( dlgFile.GetPathName() );
	}
	
}
Пример #22
0
//获得默认的文件名
BOOL CFunc::GetDefaultXlsFileName(CString& sExcelFile)
{
	///默认文件名:yyyymmddhhmmss.xls
	CString timeStr;
	CTime day;
	day=CTime::GetCurrentTime();
	int filenameday,filenamemonth,filenameyear,filehour,filemin,filesec;
	filenameday=day.GetDay();//dd
	filenamemonth=day.GetMonth();//mm月份
	filenameyear=day.GetYear();//yyyy
	filehour=day.GetHour();//hh
	filemin=day.GetMinute();//mm分钟
	filesec=day.GetSecond();//ss
	timeStr.Format("%04d%02d%02d%02d%02d%02d",filenameyear,filenamemonth,filenameday,filehour,filemin,filesec);
	
	sExcelFile =  timeStr + ".xls";
	// prompt the user (with all document templates)
	CFileDialog dlgFile(FALSE,".xls",sExcelFile);
	CString title;
	CString strFilter;
	
	title = "导出";
	strFilter = "Excel文件(*.xls)";
	strFilter += (TCHAR)'\0';   // next string please
	strFilter += _T("*.xls");
	strFilter += (TCHAR)'\0';   // last string
	dlgFile.m_ofn.nMaxCustFilter++;
	dlgFile.m_ofn.nFilterIndex = 1;
	// append the "*.*" all files filter
	CString allFilter;
	VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
	strFilter += allFilter;
	strFilter += (TCHAR)'\0';   // next string please
	strFilter += _T("*.*");
	strFilter += (TCHAR)'\0';   // last string
	dlgFile.m_ofn.nMaxCustFilter++;
	
	dlgFile.m_ofn.lpstrFilter = strFilter;
	dlgFile.m_ofn.lpstrTitle = title;
	
	if (dlgFile.DoModal()==IDCANCEL)
		return FALSE; // open cancelled
	sExcelFile.ReleaseBuffer();
	if (MakeSurePathExists(sExcelFile,true)) {
		if(!DeleteFile(sExcelFile)) {    // delete the file
			AfxMessageBox("覆盖文件时出错!");
			return FALSE;
		}
	}
	return TRUE;
}
Пример #23
0
// prompt for file name - used for open and save as
// static function called from app
BOOL CWordPadApp::PromptForFileName(CString& fileName, UINT nIDSTitle,
	DWORD dwFlags, BOOL bOpenFileDialog, int* pType)
{
	ScanForConverters();
	CFileDialog dlgFile(bOpenFileDialog);
	CString title;

	VERIFY(title.LoadString(nIDSTitle));

	dlgFile.m_ofn.Flags |= dwFlags;
//  dlgFile.m_ofn.Flags &= ~OFN_SHOWHELP;

	int nIndex = m_nFilterIndex;
	if (!bOpenFileDialog)
	{
		int nDocType = (pType != NULL) ? *pType : RD_DEFAULT;
		nIndex = GetIndexFromType(nDocType, bOpenFileDialog);
		if (nIndex == -1)
			nIndex = GetIndexFromType(RD_DEFAULT, bOpenFileDialog);
		if (nIndex == -1)
			nIndex = GetIndexFromType(RD_NATIVE, bOpenFileDialog);
		ASSERT(nIndex != -1);
		nIndex++;
	}
	dlgFile.m_ofn.nFilterIndex = nIndex;
	// strDefExt is necessary to hold onto the memory from GetExtFromType
	CString strDefExt = GetExtFromType(GetTypeFromIndex(nIndex-1, bOpenFileDialog));
	dlgFile.m_ofn.lpstrDefExt = strDefExt;


	CString strFilter = GetFileTypes(bOpenFileDialog);
	dlgFile.m_ofn.lpstrFilter = strFilter;
	dlgFile.m_ofn.lpstrTitle = title;
	dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH);

	BOOL bRet = (dlgFile.DoModal() == IDOK) ? TRUE : FALSE;
	fileName.ReleaseBuffer();
	if (bRet)
	{
		if (bOpenFileDialog)
			m_nFilterIndex = dlgFile.m_ofn.nFilterIndex;
		if (pType != NULL)
		{
			int nIndex2 = (int)dlgFile.m_ofn.nFilterIndex - 1;
			ASSERT(nIndex2 >= 0);
			*pType = GetTypeFromIndex(nIndex2, bOpenFileDialog);
		}
	}

	return bRet;
}
Пример #24
0
BOOL ntCommonDlg::PromptForFileName(CString& fileName, UINT, 
	DWORD dwFlags, BOOL bOpenFileDialog, int* pType)
{
	CFileDialog dlgFile(bOpenFileDialog);
	CString title;
	if (bOpenFileDialog) 
	{
		title=_T("Open image file"); 
	}
	else 
	{
		title=_T("Save image file");
	}

	dlgFile.m_ofn.Flags |= dwFlags;

	int nDocType = (pType != NULL) ? *pType : CXIMAGE_FORMAT_BMP;
	if (nDocType==0) 
	{
		nDocType=1;
	}

	int nIndex = GetIndexFromType(nDocType, bOpenFileDialog);
	if (nIndex == -1) 
	{
		nIndex = 0;
	}

	dlgFile.m_ofn.nFilterIndex = nIndex +1;

	CString strDefExt = GetExtFromType(nDocType).Mid(2,3);
	dlgFile.m_ofn.lpstrDefExt = strDefExt;

	CString strFilter = GetFileTypes(bOpenFileDialog);
	dlgFile.m_ofn.lpstrFilter = strFilter;
	dlgFile.m_ofn.lpstrTitle = title;
	dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH);

	BOOL bRet = (dlgFile.DoModal() == IDOK) ? TRUE : FALSE;
	fileName.ReleaseBuffer();
	if (bRet)
	{
		if (pType != NULL)
		{
			int nIndex = (int)dlgFile.m_ofn.nFilterIndex - 1;
			ASSERT(nIndex >= 0);
			*pType = GetTypeFromIndex(nIndex, bOpenFileDialog);
		}
	}
	return bRet;
}
Пример #25
0
BOOL CMyDocManager::DoPromptFileName(CString& fileName, UINT nIDSTitle,
		DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate)
{
	// From MFC: CDocManager::DoPromptFileName

	CMyFileDialog dlgFile(!!bOpenFileDialog);

	CString title;
	VERIFY(title.LoadString(nIDSTitle == AFX_IDS_OPENFILE ? IDS_OPENFILE : nIDSTitle));

	dlgFile.m_ofn.Flags |= lFlags;

	CString strFilter;
	CString strDefault;
	if (pTemplate != NULL)
	{
		ASSERT_VALID(pTemplate);
		AppendFilterSuffix(strFilter, dlgFile.m_ofn, pTemplate, &strDefault);
	}
	else
	{
		// do for all doc template
		POSITION pos = m_templateList.GetHeadPosition();
		BOOL bFirst = TRUE;
		while (pos != NULL)
		{
			CDocTemplate* pTemplate = (CDocTemplate*)m_templateList.GetNext(pos);
			AppendFilterSuffix(strFilter, dlgFile.m_ofn, pTemplate,
				bFirst ? &strDefault : NULL);
			bFirst = FALSE;
		}
	}

	// append the "*.*" all files filter
	CString allFilter;
	VERIFY(allFilter.LoadString(IDS_ALLFILTER));
	strFilter += allFilter;
	strFilter += (TCHAR)'\0';   // next string please
	strFilter += _T("*.*");
	strFilter += (TCHAR)'\0';   // last string
	dlgFile.m_ofn.nMaxCustFilter++;

	dlgFile.m_ofn.lpstrFilter = strFilter;
	dlgFile.m_ofn.lpstrTitle = title;
	dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH);

	INT_PTR nResult = dlgFile.DoModal();
	fileName.ReleaseBuffer();
	return (nResult == IDOK);
}
Пример #26
0
void CEmailDlg::OnAttachmentBrowse() 
{
	UpdateData();

	CHexFileDialog dlgFile("AttachmentDlg", HIDD_FILE_ATTACH, TRUE, NULL, attachment_,
						   OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_DONTADDTORECENT,
						   theApp.GetCurrentFilters(), "Attach", this);

	if (dlgFile.DoModal() == IDOK)
	{
		attachment_ = dlgFile.GetPathName();
		UpdateData(FALSE);
	}
}
Пример #27
0
void SettingsDlg::OnBnClickedBrowse()
{
	CFileDialog dlgFile( TRUE, _T("wav"), 0, OFN_NOCHANGEDIR, _T("WAV Files (*.wav)|*.wav|") );
	if (dlgFile.DoModal()==IDOK) {
		CString cwd;
		char * ptr = cwd.GetBuffer(MAX_PATH);
		::GetCurrentDirectory(MAX_PATH, ptr);
		cwd.ReleaseBuffer();
		if ( cwd.MakeLower() + "\\" + dlgFile.GetFileName().MakeLower() == dlgFile.GetPathName().MakeLower() ) {
			GetDlgItem(IDC_RINGING_SOUND)->SetWindowText(dlgFile.GetFileName());
		} else {
			GetDlgItem(IDC_RINGING_SOUND)->SetWindowText(dlgFile.GetPathName());
		}
	}
}
Пример #28
0
void CSvg2kicadDlg::OnButtonSVG() 
{
	CFileDialog			dlgFile(TRUE, 
							"svg", 
							(LPCTSTR) m_strSVGPathname, 
							OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY, 
							"Scalable Vector Graphics Files (*.svg)|*.svg||", 
							this);

	if (dlgFile.DoModal() == IDOK)
	{
		m_strSVGPathname = dlgFile.GetPathName();
		UpdateData(FALSE);
	}
}
Пример #29
0
void CGetEphemerisDlg::OnBnClickedBrowse()
{	
	CString f;
	m_file.GetWindowText(f);

	CFileDialog dlgFile(FALSE, _T("log"), f, 
		OFN_HIDEREADONLY, _T("ALL Files (*.*)|*.*||"), this);
	
  	INT_PTR nResult = dlgFile.DoModal();
	m_fileName = dlgFile.GetPathName();
	if(nResult == IDOK)
	{
		m_file.SetWindowText(m_fileName);
	}
}
Пример #30
0
/////////////////////////////////////////////////////////////////////////////
// CDxtexDocManager::DoPromptFileName - overridden to allow importing of
// BMPs as well as DDSs into CDxtexDocs.
BOOL CDxtexDocManager::DoPromptFileName(CString& fileName, UINT nIDSTitle,
            DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate)
{
    CFileDialog dlgFile(bOpenFileDialog);

    CString title;
    VERIFY(title.LoadString(nIDSTitle));

    dlgFile.m_ofn.Flags |= lFlags;

    CString strFilter;

    if (bOpenFileDialog)
    {
        strFilter += "Image Files (*.dds, *.hdr, *.bmp, *.tga, *.jpg, *.png, *.dib)";
        strFilter += (TCHAR)'\0';   // next string please
        strFilter += _T("*.dds;*.hdr;*.bmp;*.tga;*.jpg;*.png;*.dib");
        strFilter += (TCHAR)'\0';   // last string
        dlgFile.m_ofn.nMaxCustFilter++;
    }
    else
    {
        strFilter += "Image Files (*.dds)";
        strFilter += (TCHAR)'\0';   // next string please
        strFilter += _T("*.dds");
        strFilter += (TCHAR)'\0';   // last string
        dlgFile.m_ofn.nMaxCustFilter++;
        dlgFile.m_ofn.lpstrDefExt = _T("dds"); // .dds is the default extension
    }

    // append the "*.*" all files filter
    CString allFilter;
    VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
    strFilter += allFilter;
    strFilter += (TCHAR)'\0';   // next string please
    strFilter += _T("*.*");
    strFilter += (TCHAR)'\0';   // last string
    dlgFile.m_ofn.nMaxCustFilter++;

    dlgFile.m_ofn.lpstrFilter = strFilter;
    dlgFile.m_ofn.lpstrTitle = title;
    dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH);

    INT_PTR nResult = dlgFile.DoModal();
    fileName.ReleaseBuffer();
    return nResult == IDOK;
};