Application path
-
how do i get the path from where the application was executed ?? i am using MFC. Thanx. My God is more powerfull Than Your God. (the line that divides the world)
-
how do i get the path from where the application was executed ?? i am using MFC. Thanx. My God is more powerfull Than Your God. (the line that divides the world)
Use the GetModuleFileName() API.
CString strDirectoryPath; TCHAR zName[MAX_PATH]; TCHAR* zLast; ::GetModuleFileName(0,zName,sizeof(zName)); zLast=_tcsrchr( zName, (TCHAR)'\\'); if (zLast) *(zLast+1) = (TCHAR)'\0'; strDirectoryPath = zName; /////////////////////////// ASSERT( !strDirectoryPath.IsEmpty() ); /////////////////////////// return strDirectoryPath;
I Dream of Absolute Zero
-
Use the GetModuleFileName() API.
CString strDirectoryPath; TCHAR zName[MAX_PATH]; TCHAR* zLast; ::GetModuleFileName(0,zName,sizeof(zName)); zLast=_tcsrchr( zName, (TCHAR)'\\'); if (zLast) *(zLast+1) = (TCHAR)'\0'; strDirectoryPath = zName; /////////////////////////// ASSERT( !strDirectoryPath.IsEmpty() ); /////////////////////////// return strDirectoryPath;
I Dream of Absolute Zero
Thanx i guess this piece of code is little better. CString strAppPath; ::GetModuleFileName(NULL,strAppPath.GetBuffer(MAX_PATH),MAX_PATH); strAppPath.ReleaseBuffer(); strAppPath = strAppPath.Left(strAppPath.ReverseFind('\\')); AfxMessageBox(strAppPath); My God is more powerfull Than Your God. (the line that divides the world)
-
how do i get the path from where the application was executed ?? i am using MFC. Thanx. My God is more powerfull Than Your God. (the line that divides the world)
you can also check the GetCurrentDirectory() in the Platform SDK out: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getcurrentdirectory.asp bye,eugi www.eugigames.tk
-
you can also check the GetCurrentDirectory() in the Platform SDK out: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getcurrentdirectory.asp bye,eugi www.eugigames.tk
Current directory is not what i want, i wanted the location of the exe file. suppose the exe file is in c:\windows and if you execute the program from c:\temp then c:\temp is ur current directory and c:\windows is the source directory :-) My God is more powerfull Than Your God. (the line that divides the world)