比如说Win目录(c:\winnt),系统目录(c:\winnt\system32),程序目录(c:\program files)。不要shell的API。

解决方案 »

  1.   

    GetSystemDirectory
    GetSystemWindowsDirectory等等
      

  2.   

    UINT GetWindowsDirectory(
      LPTSTR lpBuffer,  // address of buffer for Windows directory
      UINT uSize        // size of directory buffer
    );UINT GetSystemDirectory(
      LPTSTR lpBuffer,  // address of buffer for system directory
      UINT uSize        // size of directory buffer
    );DWORD GetTempPath(
      DWORD nBufferLength,  // size, in characters, of the buffer
      LPTSTR lpBuffer       // pointer to buffer for temp. path
    );WINSHELLAPI HRESULT WINAPI SHGetSpecialFolderPath(
        HWND hwndOwner,
        LPTSTR lpszPath,
        int nFolder,
        BOOL fCreate
    );
      

  3.   

    3ks,
    我想问一下有没有Win32API(不要ShellAPI)能够获得程序的路径的(即c:\Program files这样的)。
      

  4.   

    char   szDir[MAX_PATH];
    SHGetSpecialFolderPath(NULL,szDir,CSIDL_COMMON_PROGRAMS,FALSE);
      

  5.   

    win32 API中没有吗?
    非要使用Shell API?????
      

  6.   

    you can try this
    ExpandEnvironmentStrings
    The ExpandEnvironmentStrings function expands environment-variable strings and replaces them with their defined values. DWORD ExpandEnvironmentStrings(
      LPCTSTR lpSrc, // string with environment variables
      LPTSTR lpDst,  // string with expanded strings 
      DWORD nSize    // maximum characters in expanded string
    );
      

  7.   

    GetSystemDirectory等一些函数,可以找到windows,system的路径
    但你想要更多的最好是到注册表中找HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\Shell Folders