BOOL CDDDlg::ShowFileInfo(HDROP hDropInfo)
{
char lpszFile[ 80 ];
char szBuff[ 1024 ];
POINT pt; //拖放的位置
::DragQueryPoint( hDropInfo,&pt );
CString strPos;
strPos.Format("拖放的位置:(%d %d)",pt.x,pt.y);
SetDlgItemText(IDC_FILEPOS,strPos);
WORD cFiles = ::DragQueryFile( hDropInfo,( UINT )0xFFFFFFFF,( LPTSTR )NULL,( UINT )NULL );
wsprintf( szBuff,"DragFileNumber: %d",( int )cFiles );
SetDlgItemText(IDC_FILENO,szBuff); //拖放的数量
::DragQueryFile( hDropInfo,0,lpszFile,sizeof( lpszFile ) ); //获取拖放的文件名
SetDlgItemText(IDC_FILENAME,lpszFile);
SHFILEINFO sfi;
if( ::SHGetFileInfo( lpszFile,
0,
&sfi,
sizeof( SHFILEINFO ),
SHGFI_DISPLAYNAME | SHGFI_TYPENAME|SHGFI_ICON |SHGFI_SHELLICONSIZE) )
{
memset( szBuff,0,sizeof( szBuff ) );
wsprintf( szBuff,"%s",sfi.szTypeName);
SetDlgItemText(IDC_FILETYPE,szBuff);
m_icon.SetIcon(sfi.hIcon);
}
CFileStatus fs;
CFile::GetStatus(lpszFile,fs);
CString str;
str.Format("%d",fs.m_size);
SetDlgItemText(IDC_FILESIZE,str);
str=fs.m_ctime.Format("创建时间:%Y年%M月%D日 %H:%M:%S");
SetDlgItemText(IDC_CREATETIME,str);
str=fs.m_mtime.Format("修改时间:%Y年%M月%D日 %H:%M:%S");
SetDlgItemText(IDC_MODIFYTIMIE,str);
str=fs.m_atime.Format("最后一次访问时间:%Y年%M月%D日 %H:%M:%S");
SetDlgItemText(IDC_VIS99vETIME,str);
str.Format("%s%s%s%s",
(fs.m_attribute & CFile::readOnly) ? "只读" : " ",
(fs.m_attribute & CFile::hidden) ? "隐藏" : " ",
(fs.m_attribute & CFile::system) ? "系统" : " ",
(fs.m_attribute & CFile::archive) ? "存档" : " " );
SetDlgItemText(IDC_PROPERTY,str);
return TRUE;
评论 {{userinfo.comments}}
{{child.content}}
{{question.question}}
提交