Click here to Skip to main content
14,575,257 members

Error C2039 Is Not A Member Of

Member 7766180 asked:

Open original thread
I'm trying to do conversions between Filetime and Systemtime and I'm getting an Error C2039 that OneMinuteAgo is not a meber of class FILETIME. What am I doing wrong? And how can I fix this?

#include string 
#include vector
#include windows.h
#include time.h 
#include map
struct file_data 
    std::wstring sLastAccessTime; 
    __int64 nFileSize      ; 

int GetFileList(const wchar_t *searchkey, std::map &map) 
    WIN32_FIND_DATA fd; 
    HANDLE h = FindFirstFile(searchkey,&fd); 
        return 0; // no files found 
       	wchar_t buf[128]; 
        SYSTEMTIME st;
	SystemTimeToFileTime(&st, &ftNow);
    	li.LowPart = ftNow.dwLowDateTime;
        li.HighPart = ftNow.dwHighDateTime;
	auto ftAs64 = ftNow.OneMinuteAgo.dwLowDateTime + ((unsigned__int64)         ftNow.OneMinuteAgo.dwHighDateTime << 32) - 6000000000UL;

FILETIME ftOneMinuteAgo = { (DWORD)ftAs64, (DWORD)(ftAs64 >> 32) };
FileTimeToSystemTime(&ftNow, &st); 
wsprintf(buf, L"%d-%02d-%02d",st.wYear, st.wMonth, st.wDay); 
file_data filedata; 
filedata.sLastAccessTime= buf; 
filedata.nFileSize      = (((__int64)fd.nFileSizeHigh) << 32) + fd.nFileSizeLow; 
        map[fd.cFileName]= filedata; 
        if (FindNextFile(h, &fd) == FALSE) 
return map.size(); 
Tags: C++, Windows


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100