Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

get user path

Posted on 2004-10-23
2
Medium Priority
?
425 Views
Last Modified: 2010-04-05
how can we get the path like "C:\Documents and Settings\my-user-acc\Local Settings\Application Data\Microsoft\Windows"
0
Comment
Question by:lehongwang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Expert Comment

by:sftweng
ID: 12387781
Via the registry "HKCU" - see TRegistry in Help. See also: http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20869917.html

0
 
LVL 6

Accepted Solution

by:
Amir Azhdari earned 150 total points
ID: 12387840
getspecialfolders :

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,shlobj,activex;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure freepid1(pid1:pitemidlist);
var
allocator:imalloc;
begin
if succeeded(shgetmalloc(allocator)) then
allocator.Free(pid1);
end;


procedure TForm1.Button1Click(Sender: TObject);
var
pid1:pitemidlist;
buf:array[0..MAX_PATH] of char;
i:integer;
begin
memo1.Lines.clear;
for i :=0 to 100 do                 // i= CSIDL_DESKTOP or ... look in shlobj for other
if succeeded(shgetspecialfolderlocation(handle,i,pid1)) then
if shgetpathfromidlist(pid1,buf) then
memo1.Lines.Add(buf);


freepid1(pid1);

end;

end.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question