我想请问一下利用什么函数可以得到当前程序运行的路径?谢谢!

解决方案 »

  1.   

    The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module. 
      

  2.   

    1.GetCurrentDirectory
    The GetCurrentDirectory function retrieves the current directory for the current process.
    DWORD GetCurrentDirectory(
      DWORD nBufferLength,
      LPTSTR lpBuffer
    );
    2.GetModuleFileNameThe GetModuleFileName function retrieves the fully qualified path for the specified module.To specify the process that contains the module, use the GetModuleFileNameEx function.
    DWORD GetModuleFileName(
      HMODULE hModule,
      LPTSTR lpFilename,
      DWORD nSize
    );
      

  3.   

    char condir[MAX_PATH];
    GetCurrentDirectory(MAX_PATH,condir);
      

  4.   

    用GetMouldeName,然后把后面的那个exe的文件取消就可以了。