Avatar of efz
efz
Flag for United States of America asked on

LocalAppDataFolder

From within a Delphi program, how can I determine the value of a system's localappdatafolder? Is there a particular method I can call like when I use the GetWindowsDirectory function to find the value of a systems Windows folder?
DelphiPascal

Avatar of undefined
Last Comment
efz

8/22/2022 - Mon
rfwoolf

Can you try this:

  function TFrmMainMenu.GetApplicationDataFolder: string;
  const
     SHGFP_TYPE_CURRENT = 0;
  var
    Res: HResult;
    Path: array[0..Max_Path] of Char;
  begin
    Res := ShGetFolderPath(0,CSIDL_COMMON_APPDATA,0,SHGFP_TYPE_CURRENT,path);
    if S_OK <> Res then raise Exception.Create('Could not determine application data path');
    Result := Path;
  end;
ASKER CERTIFIED SOLUTION
rfwoolf

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Mahdi78

GenFunctions.pas this pascal unit allow you to get necessary data

you download it from the following link

http://tapor.uvic.ca/~mholmes/source_code/Delphi2005/GenFunctions/GenFunctions.pas
efz

ASKER
You da man!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck