get EVERYTHING_ERROR_INVALIDCALL when calling Everything_GetResultDateModified

Plug-in and third party software discussion.
Post Reply
yemanqitipo
Posts: 11
Joined: Sat Dec 17, 2022 9:02 am

get EVERYTHING_ERROR_INVALIDCALL when calling Everything_GetResultDateModified

Post by yemanqitipo »

Hello everyone。
I want to get the modify time of a file which everything retrieves.
when I call the api Everything_GetResultDateModified, I got error code EVERYTHING_ERROR_INVALIDCALL .
I saw the doc , it says "Call Everything_Query before calling Everything_GetResultDateModified.".
But I did call Everything_Query before I call Everything_GetResultDateModified.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: get EVERYTHING_ERROR_INVALIDCALL when calling Everything_GetResultDateModified

Post by NotNull »

Did you check if you got any results back from your Everything_Query?
(with zero results itr would be hard to get any date modified ;) )

Could you post (the relevant part of) your code?
yemanqitipo
Posts: 11
Joined: Sat Dec 17, 2022 9:02 am

Re: get EVERYTHING_ERROR_INVALIDCALL when calling Everything_GetResultDateModified

Post by yemanqitipo »

Thank you for your reply.
1. Everything_Query got some results. Actually, I got 8 when I call Everything_GetNumResults.
2. My code snippet:

Code: Select all

void CustomSearch(std::wstring regexStr, bool regexFlag) {
    DWORD i;
    const int MAX_TIME_LEN = 60;
    char strTime[MAX_TIME_LEN] = { 0x00 };

    // execute the query
    Everything_QueryW(true);

    int numResults = Everything_GetNumResults();
    for (i = 0; i < numResults; i++)
    {
        wchar_t buf[MAX_PATH_LEN] = { 0x00 };
        Everything_GetResultFullPathNameW(i, buf, MAX_PATH_LEN);

        FILETIME dateModified;
        SYSTEMTIME st;
        bool ret = Everything_GetResultDateModified(i, &dateModified);
        DWORD dwLastError = Everything_GetLastError();
        if (dwLastError == EVERYTHING_ERROR_INVALIDCALL)
        {
            continue;
        }
        FileTimeToSystemTime(&dateModified, &st);
        sprintf(strTime, "%d/%d/%d %02d:%02d:%02d",
            st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
    }

}
Last edited by NotNull on Sun Feb 12, 2023 4:29 pm, edited 1 time in total.
Reason: Added code tags </>
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: get EVERYTHING_ERROR_INVALIDCALL when calling Everything_GetResultDateModified

Post by void »

Please make sure Everything is running in the background.
Please check your call to Everything_QueryW succeeds.

Please call Everything_SetRequestFlags before calling Everything_Query and set the following flags:
EVERYTHING_REQUEST_FILE_NAME | EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_DATE_MODIFIED
yemanqitipo
Posts: 11
Joined: Sat Dec 17, 2022 9:02 am

Re: get EVERYTHING_ERROR_INVALIDCALL when calling Everything_GetResultDateModified

Post by yemanqitipo »

void wrote: Mon Feb 13, 2023 1:11 am Please make sure Everything is running in the background.
Please check your call to Everything_QueryW succeeds.

Please call Everything_SetRequestFlags before calling Everything_Query and set the following flags:
EVERYTHING_REQUEST_FILE_NAME | EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_DATE_MODIFIED
Wow!Now I call Everything_SetRequestFlags before calling Everything_Query , That works.
Thank you for reply and for the greet tool.
Post Reply