aztec
asked on
Problem with SelectDirectory Function
Hi...
When the user calls the SelectDirectory function in my app, I want it to default to the root directory (ie. C:\)... but it won't do it. Here's my code:
defdir:='c:\';
if SelectDirectory(defdir,[], 0) then
speedbutton21.hint:=defdir
else speedbutton21.hint:='';
...the SelectDirectory dialog box always comes up with the directory my app is located in, as its selected directory...weird. There seems to be no way I can force it to go to the root directory.
Any thoughts?
Thanks
Shawn
When the user calls the SelectDirectory function in my app, I want it to default to the root directory (ie. C:\)... but it won't do it. Here's my code:
defdir:='c:\';
if SelectDirectory(defdir,[],
speedbutton21.hint:=defdir
else speedbutton21.hint:='';
...the SelectDirectory dialog box always comes up with the directory my app is located in, as its selected directory...weird. There seems to be no way I can force it to go to the root directory.
Any thoughts?
Thanks
Shawn
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that gives a complile error:
"Constant object cannot be passed as var parameter"
I don't think it likes the 'Please choose a directory'...it's expecting a variable.
Shawn
"Constant object cannot be passed as var parameter"
I don't think it likes the 'Please choose a directory'...it's expecting a variable.
Shawn
procedure TForm1.Button1Click(Sender
var
DefDir : string;
begin
if SelectDirectory('Please choose a directory:', 'C:\', DefDir) then
speedbutton21.hint := DefDir
else
speedbutton21.hint := '';
end;