Example #1
0
/*========================================================================
	Name:	连接 SQL SERVER 数据库. 
	-----------------------------------------------------
	Params:		[dbsrc]:	SQL SERVER 服务器名.
				[dbname]:	默认的数据库名.
				[user]:		用户名.
				[pass]:		密码.
==========================================================================*/
BOOL CAdoConnection::ConnectSQLServer(CString dbsrc, CString dbname, CString user, CString pass, long lOptions)
{
	CString strConnect = _T("Provider=SQLOLEDB.1; Data Source=") + dbsrc + 
						 _T("; Initial Catalog=") + dbname  +
						 _T("; User ID=") + user + 
						 _T("; PWD=") + pass;
	return Open(LPCTSTR(strConnect), lOptions);
}
Example #2
0
LRESULT CClientDlg::OnWinListChanged( WPARAM wp, LPARAM lp )
{
	list<WIN_INFO> info;
	m_pClient->GetWindowList( info );

	m_TextWinList1.ResetContent();
	list<WIN_INFO>::iterator I = info.begin();

	for( ; I != info.end(); I++ )
	{
		CString s1 = L"";
		if( I->placement.showCmd == SW_SHOWMAXIMIZED )
		{
			s1 = L",Maximized";
		}
		else if( I->placement.showCmd == SW_SHOWMINIMIZED )
		{
			s1 = L",Minimized";
		}
		else if( I->placement.showCmd == SW_SHOWNORMAL )
		{
			s1 = L",Normal";
		}

		CString s;
		s.Format( L"[%08X%s] - \"%s\" (%s)",
			I->id, LPCTSTR(s1), I->title, I->classname );
		#ifdef NoHideJava
		if(NULL!= wcsstr(I->classname,L"SunAwtFrame"))
			m_TextWinList1.AddItem(s,RGB(255,  0, 0), RGB(255, 255,255), I->id);
		else
		if(NULL!= wcsstr(I->classname,L"SunAwtDialog"))
			m_TextWinList1.AddItem(s,RGB(255,  0, 0), RGB(255, 255,255), I->id);
		else
		#else
			if(NULL!= wcsstr(I->classname,L"SunAwtFrame"))
			continue;
		else
			if(NULL!= wcsstr(I->classname,L"SunAwtDialog"))
			continue;
		else
		#endif
		if(NULL!= wcsstr(I->classname,L"IEFrame"))
			m_TextWinList1.AddItem(s,RGB(50,  100, 150), RGB(220, 220,220), I->id);
		else
		if(NULL!= wcsstr(I->classname,L"#"))
			m_TextWinList1.AddItem(s,RGB(0,  0, 0), RGB(245, 245,16), I->id);
		else
		if(NULL!= wcsstr(I->classname,L"Desktop"))
			m_TextWinList1.AddItem(s,RGB(0,  255, 0), RGB(0, 0,0), I->id);
		else
			m_TextWinList1.AddItem(s,RGB(255,  255, 255), RGB(0, 0,0), I->id);

	}
	m_TextWinList1.UpdateData(true);
	Log( L"Received list of windows." );
	return 0;
}
Example #3
0
/*========================================================================
Name:	连接 ACCESS 数据库. 
-----------------------------------------------------
Params:		[dbpath]:	MDB 数据库file路径名.
[pass]:		访问密码.
===========================================================================*/
BOOL CDBAccess::ConnectAccess(CString dbpath, CString pass, long lOptions)
{
	CString strConnect = _T("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=") + dbpath;
	if (pass != _T("")) 
	{
		strConnect += _T("Jet OLEDB:Database Password="******";");
	}
	return Open(LPCTSTR(strConnect), lOptions);
}
Example #4
0
void CSystemConfigDlg::DoDataExchange(CDataExchange* pDX)
{
	CString temp;
	temp.Format("%d",PacketCount);
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT_PKT_COUNT, temp);
	PacketCount = atoi( LPCTSTR(temp));
	DDX_Check(pDX, IDC_CHECK_FORCE_PRECHECK, ForcePrecheck);
}
void CDirectoryPropPage::OnAddseparatorButton() 
{
	UpdateData(TRUE);
	m_directoryeditstr += m_separatorstr;
	m_directoryformatedit.ReplaceSel(LPCTSTR(m_separatorstr));
	UpdateData(FALSE);
	m_directoryformatedit.SetFocus();
	
}
Example #6
0
void CAppConfig::SaveHistory(CFile &f)
{
	int i;
	fprintf(f, "[Menu]\r\n");
	for (i = 0; i < history_menu.GetSize(); ++i)
	{
		CString str = history_menu[i];
		if (str[0] == 's')	// bbs
		{
			int p = str.Find('\t');
			if (p <= 0)
				continue;
			int p2 = str.Find('\t', p + 1);
			if (p2 > 0)	// 有進階設定檔
			{
				CString name = str.Mid(1, p - 1);
				CString address = str.Mid(p, (p2 - p));
				CString cfg = str.Mid(p2 + 1);

				str = 's' + name;
				str += address;
				if (0 == strnicmp(cfg, ConfigPath, ConfigPath.GetLength()))
				{
					cfg = cfg.Mid(ConfigPath.GetLength());
					cfg = cfg.Left(cfg.GetLength() - name.GetLength());
					cfg.Replace(';', '\\');
					cfg += name;
					str += '\t';
					str += cfg;
				}
			}
		}
		str += "\r\n";
		f.Write(LPCTSTR(str), str.GetLength());
	}
	fprintf(f, "\r\n[DropDown]\r\n");
	for (i = 0; i < history_dropdown.GetSize(); ++i)
		fprintf(f, "%s\r\n", LPCTSTR(history_dropdown[i]));
	fprintf(f, "\r\n[Typed]\r\n");
	POSITION pos = history.GetHeadPosition();
	for (; pos; history.GetNext(pos))
		fprintf(f, "%s\r\n", LPCTSTR(history.GetAt(pos)));

}
Example #7
0
//before Subclassing 
void CMyHyperLink::PreSubclassWindow() 
{

	//Enable the Static to send the Window Messages To its parent
	DWORD dwStyle = GetStyle();
	SetWindowLong(GetSafeHwnd() ,GWL_STYLE ,dwStyle | SS_NOTIFY);

	TCHAR szCurretText[MAX_PATH];
	GetWindowText(szCurretText, MAX_PATH);
	if ((szCurretText) == NULL){
		SetWindowText(m_csLinkText.operator LPCTSTR());
	}
	
	LOGFONT sLogFont;
	GetFont()->GetLogFont(&sLogFont);
	//Set the Link UnderLined
	sLogFont.lfUnderline = true;
	//Set the Font to  the Control
	m_oTextFont.CreateFontIndirect(&sLogFont);
	this->SetFont(&m_oTextFont, true);
	
	//Adjust the window
	//IsValidURL();

	//Set the Cursor Hand
	//WinHlp32.exe in windows folder ResourceID 106
	//is a standard window HAND cursor 
	//courtesy www.codeguru.com
	//you can use a custom Hand cursor resourse also
	// i added that  as a resourse in this project with 
	// ID - IDC_CURSOR_HAND

	TCHAR szWindowsDir[MAX_PATH*2];
	GetWindowsDirectory( szWindowsDir ,MAX_PATH*2);
	_tcscat_s( szWindowsDir, MAX_PATH*2, _T( "\\Winhlp32.exe"));
	HMODULE hModule = LoadLibrary(szWindowsDir);
	
	if (hModule){
		m_hHyperCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
	}

	this->SetCursor(m_hHyperCursor);

	//free the module
	if (hModule)
		FreeLibrary(hModule);

	CStatic::PreSubclassWindow();
	this->SetCursor(m_hHyperCursor);
	
	m_ToolTip.Create(this,TTS_ALWAYSTIP);
	CRect oRect;
	GetClientRect(&oRect);
	m_ToolTip.AddTool(this, _T(""),oRect,1001);
	m_ToolTip.ShowWindow(SW_HIDE);
}
Example #8
0
void Dossier::OnClickedPhoto() 
{
#ifndef	BOB_DEMO_VER

	if (LUF_FighterLF2BAND==Persons2::GetBandFromUID(uid) && RFullPanelDial::gameside == RFullPanelDial::SIDE_LW)
	{
// launch fighters dialog

		int i=0;
		while (Node_Data.gruppe[i].squadron != SQ_ZERO)
		{
			if (Node_Data.gruppe[i].homeairfield == uid)
			{
				if (Node_Data.gruppe[i].AcType()<PT_LW_BOMBERS)
				{
					MainToolBar().OpenACDossier(Node_Data.gruppe[i].wadernum,
						Node_Data.gruppe[i].gruppennum);

					break;
				}
			}
			i++;
		}
	}
	else	
	{
 		if (ReconnRequired())
		{
			int packnum=Todays_Packages_NewPackage(uid,MMC.directives.lw.userprofiles[Directives::LW::RECON]);
			if (packnum < 0)
				RDialog::RMessageBox(IDS_WARNING, IDS_NOAIRCRAFTAVAIL,NULL,NULL,IDS_CONTINUE);
			else
			{
				Todays_Packages[packnum].CalcRoutePositionsAndTime();
				MainToolBar().OnClickedMissionfolder();
				Todays_Packages.InvalidateRoute(&Todays_Packages[packnum],true,true);

			}
		}else
		{
	#ifndef NDEBUG
	#define PLACEMENT	CRect(0,0,512,384)
	#else
	#define	PLACEMENT	Place(POSN_CENTRE,POSN_CENTRE, 0, 0)
	#endif
	//	#define PLACEMENT	CRect(0,0,512,384)
			UniqueID targID=UniqueID(uid);
			CString tname=GetTargName(targID);
			OverLay.SetTargName((char*)LPCTSTR(tname));
			OverLay.loader_art=FIL_LOADING;									//RJS 16Aug00
			LogChild(0,MakeTopDialog(PLACEMENT,DialBox(OverLay.loader_art,new Rtestsh1(UniqueID(uid)),EDGES_NOSCROLLBARS)));
			Rtestsh1::Start3d(Rtestsh1::S3D_DONEBACK);
		}
	}
#endif
}
void CBrowseForFolder::SetStatusText(const CString& strText) const
{
	if (m_hwnd == NULL)
		return;

	CString oPathString = FormatLongPath(strText);

	(void)SendMessage(m_hwnd, BFFM_SETSTATUSTEXT, NULL,
		reinterpret_cast<long>(LPCTSTR(oPathString/*strText*/)));
}
Example #10
0
//open the URL by Windows ShellExecute()
bool CMyHyperLink::GoToLinkUrl(CString csLink)
{

	HINSTANCE hInstance = (HINSTANCE)ShellExecute(NULL, _T("open"), csLink.operator LPCTSTR(), NULL, NULL, 2);

	if ((UINT)hInstance < HINSTANCE_ERROR){
		return false;
	}else
		return true;
}
Example #11
0
CFilePath &CFilePath::operator = (LPCWSTR psString)
{
    if (psString == msPath.operator LPCTSTR())
        return *this;

    msPath = psString;
    Clean();

    return *this;
}
Example #12
0
void Msg(const char *msg, ...)
{
	CString str;
	va_list ap;
	va_start(ap, msg);
	str.FormatV(msg, ap);
	va_end(ap);
	
	GetBkEndUI()->DoMessageLine(str.operator LPCTSTR(), mmBlueTriangle);
}
Example #13
0
BOOL SeriesValuesDialog::OnInitDialog() 
{
	int i, j; CString T, T1;

	CDialog::OnInitDialog();
	
	void *x;
	if((x=Series->GainAcsess(READ))!=NULL)
	{
		SeriesProtector guard(x); TSeriesArray& series(guard);
		TChartSeries *graph=series[graph_num];
		graph->GetInfo(strs); ListBox1.ResetContent();  for(i=0;i<strs.GetSize();i++) ListBox1.AddString(strs[i]);			

		LV_ITEM lvi; lvi.mask = LVIF_TEXT;
		ListBox2.InsertColumn(0,"N",LVCFMT_CENTER,40,0);
		ListBox2.InsertColumn(1,"X",LVCFMT_CENTER,50,1);
		ListBox2.InsertColumn(2,"Y",LVCFMT_CENTER,60,2);
		ListBox2.InsertColumn(3,"dY",LVCFMT_CENTER,60,3);	
		ListBox2.InsertColumn(4,"Type",LVCFMT_CENTER,60,3);		
		ListBox2.DeleteAllItems();

		for(i=0;i<graph->GetSize();i++)
		{
			lvi.iItem = i; lvi.iSubItem = 0; T.Format("%d",i);		
			lvi.pszText = (char*)LPCTSTR(T);
			ListBox2.InsertItem(&lvi);
			graph->FormatElement(i,T); 
			int j_last=0, j_cur;
			for(j=0;j<4;j++)
			{			
				if((j_cur=T.Find(9,j_last))>0)
				{
					T1=T.Mid(j_last,j_cur-j_last);
					ListBox2.SetItemText(i,j+1,(char*)LPCTSTR(T1));					
					j_last=j_cur+1;
				}
			}	
		}
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Example #14
0
void CDlg_H323::PopupCallingDlg()
{
	if(!m_pCallingDlg)
		m_pCallingDlg = new CCallingDlg;
	if(m_pCallingDlg->GetSafeHwnd() == NULL)
		m_pCallingDlg->Create(IDD_DLG_H323_CALLING,this);
	m_pCallingDlg->ShowWindow(SW_SHOW);
	UpdateData(TRUE);
	m_pCallingDlg->ShowTip(LPCTSTR(m_strCalled));
}
Example #15
0
void CDlg_H323::SaveAdvSetup()
{
	LPCTSTR strFile = ".\\H323.ini";
	TCHAR strOpt[10];
	LPCTSTR strApp = "网守设置";

	if(m_bViaGK)
		_tcscpy(strOpt,"TRUE");
	else
		_tcscpy(strOpt,"FALSE");
	
	WritePrivateProfileString(strApp,"用网守呼叫",strOpt,strFile);
	if(m_bViaGK)
		WritePrivateProfileString(strApp,"网守",LPCTSTR(m_strGatekeeper),strFile);

	if(m_bName)
		_tcscpy(strOpt,"TRUE");
	else
		_tcscpy(strOpt,"FALSE");

	WritePrivateProfileString(strApp,"用账户名登录",strOpt,strFile);
	if(m_bName)
		WritePrivateProfileString(strApp,"账户名",LPCTSTR(m_strName),strFile);

	if(m_bNumber)
		_tcscpy(strOpt,"TRUE");
	else
		_tcscpy(strOpt,"FALSE");

	WritePrivateProfileString(strApp,"用电话号码登录",strOpt,strFile);
	if(m_bNumber)
		WritePrivateProfileString(strApp,"电话号码",LPCTSTR(m_strNumber),strFile);

	if(m_bViaGW)
		_tcscpy(strOpt,"TRUE");
	else
		_tcscpy(strOpt,"FALSE");

	WritePrivateProfileString("网关设置","使用网关呼叫",strOpt,strFile);
	if(m_bViaGW)
		WritePrivateProfileString("网关设置","网关",LPCTSTR(m_strGateway),strFile);

}
void CTabbedTreeChild::OnEDITFindAgain()
{
	if(gsFindWhat.IsEmpty())
		OnEditFind();
	else
	{
		FINDREPLACE find;
#ifndef rde270
		LPCTSTR p = LPCTSTR(gsFindWhat);
		find.lpstrFindWhat = (LPTSTR)p;
#else   // rde270
		const char* p = LPCTSTR(gsFindWhat);
		find.lpstrFindWhat =const_cast<char*> (p);
#endif  // rde270
		find.Flags=gdwFindFlags;
		getTabBar()->doFindReplace(&find);
	}

}
Example #17
0
LRESULT CDlg_H323::OnSendConnect(WPARAM wParam,LPARAM lParam)
{
	GetDlgItem(IDC_H323_HANGUP)->EnableWindow(TRUE);
	AddParty(myContext->remoteIP);
	if(!m_bName)
		AddParty(myContext->localIP);
	else
		AddParty(LPCTSTR(m_strName));
    return 0;
}
Example #18
0
void CHistoryDlg::UpdateHistoryInfoLabel()
{
	TCHAR szLabel[256];

	CString strResourceBundleString;
	strResourceBundleString.LoadString(IDS_ARTICLE_SUBJECT_LINE);

	sprintf(szLabel, LPCTSTR(strResourceBundleString), m_nEntries - m_nDeleted, m_nDeleted, m_nEntries);
	SetDlgItemText(IDC_LABEL_HISTORY_INFO, szLabel);
}
void MColorDialog::OnBnClickedPreview()
{
	colorDataToVar(DIFFUSE);
	
	CString tmp;

	tmp.Format("Diffuse color: R %3d G %3d B %3d", m_clr_diffuse.r, m_clr_diffuse.g, m_clr_diffuse.b);

	AfxMessageBox(LPCTSTR(tmp));
}
// returns the path compressed into 8.3 format called a "short path"
CString CPathDescriptor::getShortPath() const
{
	if(!fileExists())	// GetShortPathName() won't work unless the file exists
	{
		//jdh 2/9/00 added an exception here, had just an assert
		CString sError("This file doesn't exist: ");
		sError += LPCTSTR(*this);
		throw(sError);

		//ASSERTX(FALSE);
		//return *this;	// at least this is better than returning junk
	}

	char shortPath[1001];
	*shortPath = 0; // testing
	int x = GetShortPathName( LPCTSTR(*this), shortPath, 1000);
	ASSERTX(x <1001 );
	return CString(shortPath);
}
void CMFCApplication1Dlg::timer() { //postavlja timer na poèetku igre
	SetTimer(0, 100, NULL);
	CWnd* temp_time = GetDlgItem(IDC_TIMER);
	CString t_time;
	duration = 3;
	t_time.Format(_T("%.1f"), duration);
	temp_time->SetWindowText(LPCTSTR(t_time));


}
Example #22
0
DWORD Registry::GetDataType(String strValueName)
{
	HKEY hKey;
	ASSERT(m_strCurrentPath.GetLength() > 0);

	m_nLastError = ::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath), 0,
		KEY_QUERY_VALUE, &hKey);

	if (m_nLastError != ERROR_SUCCESS) return 0;

	DWORD dwType = 1;
	m_nLastError = ::RegQueryValueEx(hKey, LPCTSTR(strValueName),
		NULL, &dwType, NULL, NULL);
	::RegCloseKey(hKey);		

	if (m_nLastError == ERROR_SUCCESS) return dwType;

	return 0;
}
void CAddVariableDlg::validate_variable_name(int set_focus) {
	CString temp_name;

	CEdit *edit = (CEdit *) GetDlgItem(IDC_ADD_VARIABLE_NAME);
	edit->GetWindowText(temp_name);

	// Check if any change and not already in list
	if (stricmp(temp_name, "<Variable Name>")) {
		size_t len = strlen(temp_name);

		if ((len > 0) && (get_index_sexp_variable_name(LPCTSTR(temp_name)) == -1)) { //not already in list and length > 0 { //-V805
			// Goober5000 - replace spaces with hyphens
			if (strchr(temp_name, ' ') != NULL) {
				// display msg
				MessageBox("Variable names cannot contain spaces.  Replacing with hyphens.");

				// replace chars
				//Modified to make the code build. - Thunderbird
				temp_name.Replace((TCHAR) ' ', (TCHAR) '-');
				//temp_name.Replace((TCHAR) ' ', (TCHAR) '-'));

				// fix what's displayed
				edit->SetFocus();
				edit->SetWindowText(temp_name);
				edit->SetSel(0, -1);
			}

			m_name_validated = true;
		} else {
			// conflicting variable name
			if (len == 0) {
				edit->SetWindowText("<Variable Name>");
			}
			m_name_validated = false;
			if (set_focus == RESET_FOCUS) {
				if (len == 0) {
					MessageBox("Variables must have a unique name.");
				} else {
					MessageBox("Another variable has this name already. Please choose another.");
				}
				edit->SetFocus();
				edit->SetSel(0, -1);
			}
		}
	} else {
		// name unchanged from default
		m_name_validated = false;
		if (set_focus == RESET_FOCUS) {
			MessageBox("Invalid variable name");
			edit->SetFocus();
			edit->SetSel(0, -1);
		}
	}

}
Example #24
0
int CDlg_H323::WhatTypeIsDestStr(CString strCalled)
{
	int nCount = strCalled.GetLength();
	TCHAR ch;
	BOOL bIsnotNumber = FALSE;
	for(int i = 0; i < nCount; i++)
	{
		ch = strCalled.GetAt(i);
		if((ch < '0' && ch != '*' && ch != '#') || ch > '9')
		{
			bIsnotNumber = TRUE;
			break;
		}
	}

	if(bIsnotNumber == FALSE)
		return 1;		//号码类型
	
	int nIdx;
	BOOL bIsnotIp = FALSE;
	int nDotNum = 0;
	while((nIdx = strCalled.Find('.')) != -1)
	{
		nDotNum++;
		CString strLeft = strCalled.Left(nIdx);
		nCount = strCalled.GetLength();
		strCalled = strCalled.Right(nCount - nIdx -1);
		// for(i = 0; i < strLeft.GetLength(); i++)     XT-20110328
        for(int i = 0; i < strLeft.GetLength(); i++) // XT+20110328
		{
			ch = strLeft.GetAt(i);
			if(ch < '0'  || ch > '9')
			{
				bIsnotIp = TRUE;
				break;
			}
		}
		if(bIsnotIp == TRUE)
			break;
		else if(atoi(LPCTSTR(strLeft)) > 255)
		{
			bIsnotIp = TRUE;
			break;
		}
	}

	if(bIsnotIp == FALSE && nDotNum != 3)
		bIsnotIp = TRUE;

	if(bIsnotIp == FALSE)
		return 0;	//Ip地址类型

	return 2;		//账户类型
}
Example #25
0
BOOL CRegistry::WriteFont(CString strName, CFont* pFont)
{
	ATLASSERT(m_strCurrentPath.GetLength() > 0);
	BOOL bSuccess = TRUE;
	HKEY hKey;

	LOGFONT lf;
	pFont->GetLogFont(&lf);

	if (::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath), 0,
		KEY_WRITE, &hKey) != ERROR_SUCCESS) return FALSE;
	
	if (::RegSetValueEx(hKey, LPCTSTR(strName), 0,
		REG_BINARY, (LPBYTE)&lf, sizeof(lf))
		 != ERROR_SUCCESS) bSuccess = FALSE;
		
	if (!m_bLazyWrite) ::RegFlushKey(hKey);
	::RegCloseKey(hKey);
	return bSuccess;
}
Example #26
0
void CSystemConfigDlg::OnEnChangeEditPktCount()
{
	CString temp1, temp2;
	GetDlgItem(IDC_EDIT_PKT_COUNT)->GetWindowText(temp1);
	PacketCount = atoi( LPCTSTR(temp1));
	temp2.Format("%d",PacketCount);
	if(temp1.CompareNoCase(temp2))
	{
		GetDlgItem(IDC_EDIT_PKT_COUNT)->SetWindowText(temp2);
	}
}
Example #27
0
LRESULT CIEDlg::OnUpdateStatus(WPARAM wp, LPARAM lp)
{
	if (m_PluginInst) {
		UINT len = m_StatusText.GetLength() + 1;
		UINT ulen = MultiByteToWideChar( CP_ACP, 0, LPCTSTR(m_StatusText), len, NULL, 0 );
		WCHAR* utext = new WCHAR[ ulen ];
		if( utext )	{
			ulen = MultiByteToWideChar( CP_ACP, 0, LPCTSTR(m_StatusText), len, utext, ulen );
			len = WideCharToMultiByte( CP_UTF8, 0, utext, ulen, NULL, 0, NULL, NULL );
			char* u8text = new char[ len ];
			WideCharToMultiByte( CP_UTF8, 0, utext, ulen, u8text, len, NULL, NULL );
			NPN_Status( m_PluginInst->getInstance(), u8text );
			delete []u8text;
			delete []utext;
			return 0;
		}
		else NPN_Status( m_PluginInst->getInstance(), "" );
	}
	return LRESULT(0);
}
void CRecordPlayerDlg::OnExport() 
{
	CString	filter(LPCTSTR(IDS_MIDI_FILE_FILTER));
	CPathStr	title;
	m_TitleText.GetWindowText(title);
	title.RemoveExtension();
	CFileDialog	fd(FALSE, MIDI_FILE_EXT, title, OFN_OVERWRITEPROMPT, filter);
	if (fd.DoModal() == IDOK) {
		Export(fd.GetPathName());
	}
}
Example #29
0
CString CMainPropertyPage2::BrowseForFolder(const CString& strTitle, const CString& strNowPath)
{
	TCHAR		szDisplayName[MAX_PATH] = _T("\0");

	BROWSEINFO	bi = {
		m_hWnd,
		NULL,
		szDisplayName,
		LPCTSTR(strTitle),				//+++ strTitle.GetBuffer(0),	//+++
		BIF_RETURNONLYFSDIRS,
		&BrowseCallbackProc,
		(LPARAM) LPCTSTR(strNowPath),	//+++ (LPARAM)strNowPath.GetBuffer(0),
		0
	};

	CItemIDList idl;

	idl.Attach( ::SHBrowseForFolder(&bi) );
	return idl.GetPath();
}
Example #30
0
BOOL CMesh::loadFromTMP(CString sFileName)
// ----- format: tmp -----
//face type:
//      n
//vertex:
//      x y z
//face:
//      v1 v2 v3  (the vertex index is 1-based)
{
	
	//open the file
	FILE *f = NULL;
	if ((f = fopen(LPCTSTR(sFileName),"rb")) == NULL) return FALSE;

	//k-polygon
	UINT N;
	fscanf(f,"%ld",&N);
	//points
	fscanf(f,"%ld",&m_nVertex);

	m_pVertex = new CVertex[m_nVertex];
	if (m_pVertex == NULL) { clear();fclose(f);	return FALSE;}//out of memory

	UINT i;
	short j;
	for (i = 0; i < m_nVertex; i++)
	{
		fscanf(f,"%lf",&(m_pVertex[i].m_vPosition.x));
		fscanf(f,"%lf",&(m_pVertex[i].m_vPosition.y));
		fscanf(f,"%lf",&(m_pVertex[i].m_vPosition.z));
	}

	UINT iVertex;
	//polygons
	fscanf(f,"%ld",&m_nFace);
	m_pFace = new CFace[m_nFace];
	if (m_pFace == NULL) { clear(); fclose(f); return FALSE;}//out of memory
	for (i = 0; i < m_nFace; i++)
	{
		m_pFace[i].Create(N);
		for (j = 0; j < N; j++)
		{
			fscanf(f,"%ld",&iVertex);
			m_pFace[i].m_piVertex[j]=iVertex-1;
		}
	}

	fclose(f);

	m_nEdge=3*m_nFace;

	return construct();

}