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

x
?
Solved

Problem with SelectDirectory Function

Posted on 2002-04-16
3
Medium Priority
?
268 Views
Last Modified: 2010-04-04
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
0
Comment
Question by:aztec
[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
3 Comments
 
LVL 5

Expert Comment

by:alanwhincup
ID: 6946040
You could do it like this:

procedure TForm1.Button1Click(Sender: TObject);
var
  DefDir : string;
begin
  if SelectDirectory('Please choose a directory:', 'C:\', DefDir) then
    speedbutton21.hint := DefDir
  else
    speedbutton21.hint := '';
end;
0
 
LVL 10

Accepted Solution

by:
Jacco earned 200 total points
ID: 6946050
It works if you initialize defdir to "c:\*.*"

Regards Jacco

P.S. It seems to be a small bug in FileCtrl.ProcessPath
0
 

Author Comment

by:aztec
ID: 6946067
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
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

610 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