我不会VC++,是仿造人家的代码自己写的,但编译成DLL后调用不成功 主要功能是,设置文件的创建时间 BOOL WINAPI SetFileDateTime(LPCSTR lpFileName,WORD wYear,WORD wMonth,WORD wDay,WORD wHour,WORD wMinute,WORD wSecond) { HANDLE hFile,sFile; FILETIME LocalFileTime,FileTime; SYSTEMTIME SystemTime;
hFile=CreateFile(lpFileName,0,0,NULL,OPEN_EXISTING,0,NULL); if (hFile==INVALID_HANDLE_VALUE) return FALSE; SystemTime.wYear=wYear; SystemTime.wMonth=wMonth; SystemTime.wDay=wDay; SystemTime.wHour=wHour; SystemTime.wMinute=wMinute; SystemTime.wSecond=wSecond; SystemTime.wMilliseconds=0; SystemTimeToFileTime(&SystemTime,&LocalFileTime);
LocalFileTimeToFileTime(&LocalFileTime,&FileTime);
SetFileTime(hFile,&FileTime,&FileTime,&FileTime);
// if ( SetFileTime(hFile,FileTime,FileTime,FileTime) == 0 ) return FALSE; //if ( SetFileTime(hFile,&FileTime,&FileTime,&FileTime) == 0 ) return FALSE;
CloseHandle(hFile);
return TRUE;
}