home *** CD-ROM | disk | FTP | other *** search
- unit UnitSpecialPaths;
- {
- Purpose:
- Return the paths to special folders used throught the program
- }
-
- interface
-
- type TSpecialPaths = class(TObject)
- private
- function GetPath(CLSIDL : word) : string;
- public
- function GetStartupPath : string;
- function GetCommonStartupPath : string;
- function GetAltStartupPath : string;
- function GetStartRightStartup : string;
- end;
- var SpecialPaths : TSpecialPaths;
-
- {////////////////////}
- {//}implementation{//}
- {////////////////////}
-
- uses ShellAPI, ShlObj, Windows, Forms, SysUtils;
-
- function TSpecialPaths.GetPath(CLSIDL : word) : string;
- var p : PItemIDList;
- Path: array[0..MAX_PATH] of char;
- begin
- SHGetSpecialFolderLocation(Application.Handle , CLSIDL, p);
- SHGetPathFromIDList(p, path);
- result := path;
- end;
-
-
- function TSpecialPaths.GetStartupPath : string;
- begin
- result := self.GetPath(CSIDL_STARTUP);
- end;
-
- function TSpecialPaths.GetCommonStartupPath : string;
- begin
- result := self.GetPath(CSIDL_COMMON_STARTUP);
- end;
-
- function TSpecialPaths.GetAltStartupPath : string;
- begin
- result := self.GetPath(CSIDL_ALTSTARTUP);
- end;
- function TSpecialPaths.GetStartRightStartup : string;
- begin
- result := IncludeTrailingPathDelimiter(
- ExtractFilePath(Application.ExeName)) + 'Startup\';
- end;
-
- initialization
- SpecialPaths := TSpecialPaths.Create;
- end.
-