Special windows directories

I'd be glad if someone could say me how can i get these windows special directories: recent documents, start menu.
TadasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lmikleCommented:
Use a SHGetSpecialFolderPath function (ShlObj unit).

var
  sPath : String;
  pPath : PChar;
begin
  GetMem(pPath,1024);
  If SHGetSpecialFolderPath(Application.Handle,
                            pPath,
                            CSIDL_RECENT,
                            False) Then
    Begin
      sPath := StrPas(pPath);
      ShowMessage('Recent path is '+sPath);
    End;

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lmikleCommented:
Sorry, forget FreeMem in the end of code - add as last following line:

FreeMem(sPath,1024);

0
emadatCommented:
Use this function:

You should include the use of these units in your code:

ActiveX, SHFolder, ShlObj

//******************************************************************************
function GetSpecialPath(frmHandle: hWnd; iFolder: integer): string;
var
     Allocator: IMalloc;
     SpecialDir: PItemIdList;
     FBuf: array[0..MAX_PATH] of Char;
     PerDir: string;
begin
     if SHGetMalloc(Allocator) = NOERROR then
     begin
          SHGetSpecialFolderLocation(frmHandle, iFolder, SpecialDir);
          SHGetPathFromIDList(SpecialDir, @FBuf[0]);
          Allocator.Free(SpecialDir);
          result := string(FBuf);
     end;
end;
//******************************************************************************


possible constants are:

  CSIDL_DESKTOP
  CSIDL_INTERNET
  CSIDL_PROGRAMS
  CSIDL_CONTROLS
  CSIDL_PRINTERS
  CSIDL_PERSONAL
  CSIDL_FAVORITES
  CSIDL_STARTUP
  CSIDL_RECENT
  CSIDL_SENDTO
  CSIDL_BITBUCKET
  CSIDL_STARTMENU
  CSIDL_DESKTOPDIRECTORY
  CSIDL_DRIVES
  CSIDL_NETWORK
  CSIDL_NETHOOD
  CSIDL_FONTS
  CSIDL_TEMPLATES
  CSIDL_COMMON_STARTMENU
  CSIDL_COMMON_PROGRAMS
  CSIDL_COMMON_STARTUP
  CSIDL_COMMON_DESKTOPDIRECTORY
  CSIDL_APPDATA
  CSIDL_PRINTHOOD
  CSIDL_ALTSTARTUP
  CSIDL_COMMON_ALTSTARTUP
  CSIDL_COMMON_FAVORITES
  CSIDL_INTERNET_CACHE
  CSIDL_COOKIES
  CSIDL_HISTORY
0
TadasAuthor Commented:
Thanks for Imikle and emadat. You helped me a lot. Actually, I likes imikle's comment more, but that doesn't matter.
0
TadasAuthor Commented:
Experts-exchange is awsome thing. Thanks for answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.