예제 #1
0
void CDlgOptSmart::OnTempBrowse() 
{
	CBrowseForFolder bf;	
	bf.strTitle.LoadString(IDS_SELECTTEMP);
	m_temp.GetWindowText(bf.strStartupDir);
	if (bf.GetFolder(m_pOptions->m_szTemp))
		m_temp.SetWindowText(m_pOptions->m_szTemp);	
}
int __stdcall CBrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
	CBrowseForFolder* pbff = reinterpret_cast<CBrowseForFolder*>(lpData);
	pbff->m_hwnd = hwnd;
	if (uMsg == BFFM_INITIALIZED)
		pbff->OnInit();
	else if (uMsg == BFFM_SELCHANGED)
		pbff->OnSelChanged(reinterpret_cast<LPITEMIDLIST>(lParam));
	
	return 0;
}
void CRootDlg::OnBrowse() 
{
	CBrowseForFolder bf;	
	bf.hWndOwner = this->m_hWnd;
	bf.strTitle = "Select a folder...";
	CString init;
	m_CustomName.GetWindowText(init);
	if(init=="" &&m_Filename!=""){
		char drive[_MAX_DRIVE];
		char dir[_MAX_DIR];
		_splitpath(LPCSTR(m_Filename), drive, dir, NULL, NULL);
		init.Format("%s%s", drive, dir);
	}
	bf.strStartupDir = init;

	if (bf.GetFolder(init)){
		m_CustomName.SetWindowText(init);
	}

	SetState();
}