I’ve read some problems with “Access Violation” on the net but this is very weird for me
I have tested some “solutions” but with no results
This is the piece of code:
TDateTime CFileVersionInfo::GetFileDate() const
{
FILETIME local;
SYSTEMTIME st;
TDateTime res;
FILETIME ft;
ft.dwLowDateTime = m_FileInfo.dwFileDateLS;
ft.dwHighDateTime = m_FileInfo.dwFileDateMS;
FileTimeToLocalFileTime(&ft, &local);
FileTimeToSystemTime(&local, &st) ;
//GetLocalTime(st);
res = SystemTimeToDateTime(st) ;
return res;
}
I can Make or Build the program with no problems but when I run the program it show me the Access Violation error, if I comment the function:
// TDateTime dateTime = fvi.GetFileDate();
The program run perfectly
I’m not a C++ pro I just want to make a program for personal use so I ask this question to expert
EDIT:
I’ve resolved the problem
TDateTime CFileVersionInfo::GetFileDate() const
{
_FILETIME local;
_SYSTEMTIME st;
TDateTime res;
FILETIME ft;
ft.dwLowDateTime = m_FileInfo.dwFileDateLS;
ft.dwHighDateTime = m_FileInfo.dwFileDateMS;
FileTimeToLocalFileTime(&ft, &local);
FileTimeToSystemTime(&local, &st) ;
GetLocalTime(&st); // <-- This is the solution.. for now...
res = SystemTimeToDateTime(st) ;
return res;
}
I’ve resolved the problem