[ACCEPTED]-MFC: GetCurrentDirectory function-mfc

Accepted answer
Score: 18

GetCurrentDirectory is a simple Win32 API 1 function, so just call it like this:

TCHAR currentDir[MAX_PATH];
GetCurrentDirectory( MAX_PATH, currentDir );
Score: 6

I assume you are trying to get the directory 3 where your .exe file is located instead 2 of the current directory. This directory 1 can be different from the current directory.

    TCHAR buff[MAX_PATH];
    memset(buff, 0, MAX_PATH);
    CString strFolder = buff;
    strFolder = strFolder.Left(strFolder.ReverseFind(_T('\\'))+1);    

More Related questions