16,472
社区成员
发帖
与我相关
我的任务
分享
void CmacDlg::OnBnClickedButton3()
{
// TODO: 在此添加控件通知处理程序代码
static LPFILETIME filetime1;
static LPFILETIME filetime2;
static LPFILETIME filetime3;
//HANDLE file=CFile(_T("data\\card.dat"), CFile::modeRead);
HANDLE hDir = ::CreateFile (_T("data\\card.dat"), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
::GetFileTime(hDir,filetime1,filetime2,filetime3);
CString str1,str2,strTime;
filetime3->dwHighDateTime;
filetime3->dwLowDateTime;
//str1.Format("%d",(filetime3->dwHighDateTime));
//str2.Format("%d",time2);
//strTime=str1+str2;
//MessageBox(strTime);
}
HANDLE hFile = CreateFile (_T("data\\card.dat"), GENERIC_READ,
FILE_SHARE_READ,
NULL, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL);
FILETIME ftCreate, ftAccess, ftWrite;
if(hFile!=INVALID_HANDLE_VALUE)
{
//ftWrite就是最后修改时间
GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite);
}
CloseHandle(hFile);
SYSTEMTIME stUTC;
FileTimeToSystemTime(&ftWrite, &stUTC);
CString str1,str2,str3,strTime;
str1.Format("%d",stUTC.wYear);
str2.Format("%d",stUTC.wMonth);
str3.Format("%d",stUTC.wDay);
strTime=str1+str2+str3;
MessageBox(str1+str2+str3);