主要源码:
void CFDlg::OnChangeEdit1()
{
UpdateData()
m_strExt.MakeUpper()
m_list.ResetContent()
if(m_strExt.GetLength()==0) return
CStdioFile sf
if(sf.Open("FileExt.txt",cfile::modeRead))
{
CString strTemp,strOut
while(sf.ReadString(strTemp))
{
if(strTemp.Left(m_strExt.GetLength()) ==m_strExt)
{
m_list.AddString(strTemp)
}
}
}
sf.Close()
m_list.SetCurSel(0)
this->OnSelchangeList2()
}
void CFDlg::OnSelchangeList2()
{
CString strTemp,strExt
m_list.GetText(m_list.GetCurSel(),strTemp)
strExt=strTemp.Left(strTemp.FindOneOf(" ")) //MessageBox(strExt)
CString strFileName ="eee."+strExt //MessageBox(strFileName)
SHFILEINFO shfi
memset(&shfi,0,sizeof(shfi)) //或者ZeroMemory(&shfi,sizeof(shfi))
::SHGetFileInfo(strFileName,
FILE_ATTRIBUTE_NORMAL,
&shfi,
sizeof(shfi),
SHGFI_ICON|SHGFI_USEFILEATTRIBUTES)
m_icon.SetIcon(shfi.hIcon)
}
标签:
OnChangeEdit1
UpdateData
ResetConte
MakeUpper
上传时间:
2013-12-20
上传用户:zl5712176