請問有沒有涵數可得知系統的啟動資料夾路徑?
(c:\windows\startup\)

解决方案 »

  1.   

    SHGetSpecialFolderPath Function  --------------------------------------------------------------------------------Retrieves the path of a special folder, identified by its CSIDL. SyntaxBOOL SHGetSpecialFolderPath(          HWND hwndOwner,
        LPTSTR lpszPath,
        int nFolder,
        BOOL fCreate
    );
    ParametershwndOwner
    Handle to the owner window the client should specify if it displays a dialog box or message box. 
    lpszPath
    Pointer to a null-terminated string that receives the drive and path of the specified folder. This buffer must be at least MAX_PATH characters in size.
    nFolder
    A CSIDL that identifies the folder of interest. If a virtual folder is specified, this function will fail. 
    fCreate
    Indicates if the folder should be created if it does not already exist. If this value is nonzero, the folder will be created. If this value is zero, the folder will not be created. 
    Return ValueReturns TRUE if successful, or FALSE otherwise. ResThe Microsoft Internet Explorer 4.0 Desktop Update must be installed for this function to be available.With Microsoft Windows 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable dynamic-link library (DLL), ShFolder.dll. Function InformationMinimum DLL Version shell32.dll version 4.71 or later 
    Custom Implementation No 
    Header shlobj.h 
    Import library shell32.lib 
    Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0 
      

  2.   

    CSIDL  --------------------------------------------------------------------------------CSIDL values provide a unique system-independent way to identify special folders used frequently by applications, but which may not have the same name or location on any given system. For example, the system folder may be "C:\Windows" on one system and "C:\Winnt" on another.ConstantsCSIDL_FLAG_CREATE (0x8000)
    Version 5.0. Combine this CSIDL with any of the following CSIDLs to force the creation of the associated folder. CSIDL_ADMINTOOLS (0x0030)
    Version 5.0. The file system directory that is used to store administrative tools for an individual user. The Microsoft Management Console (MMC) will save customized consoles to this directory, and it will roam with the user.CSIDL_ALTSTARTUP (0x001d)////////////here is your want id;
    The file system directory that corresponds to the user's nonlocalized Startup program group.CSIDL_APPDATA (0x001a)
    Version 4.71. The file system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings\username\Application Data. This CSIDL is supported by the redistributable Shfolder.dll for systems that do not have the Microsoft Internet Explorer 4.0 integrated Shell installed.CSIDL_BITBUCKET (0x000a)
    The virtual folder containing the objects in the user's Recycle Bin.CSIDL_CDBURN_AREA (0x003b)
    Version 6.0. The file system directory acting as a staging area for files waiting to be written to CD. A typical path is C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\CD Burning.CSIDL_COMMON_ADMINTOOLS (0x002f)
    Version 5.0. The file system directory containing administrative tools for all users of the computer.CSIDL_COMMON_ALTSTARTUP (0x001e)
    The file system directory that corresponds to the nonlocalized Startup program group for all users. Valid only for Microsoft Windows NT systems.CSIDL_COMMON_APPDATA (0x0023)
    Version 5.0. The file system directory containing application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data.