Mapping in delphi

I used the following command to map network drives:
This would map drive K: to access rsg\prod\apps1 server

However, everybodies computer has different mapping.
I set it to a constant "K:", however, to someobody elses
computer K: might already be used.  

How do I do mapping without hard coding the drive letter?

And is there a way to retrieve what LETTER was assign
to that drive?

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.

or using, say, z?

You can use WNetGetConnection to ask which UNC path belongs to a specific drive.
What do you mean with "mapping without hard coding the drive letter"? You mean, you want to find a "free" letter, than use this one for mapping?
Then look at the API GetLogicalDrives to find free letters...

Regards, Madshi.
waipahuAuthor Commented:
Madshi, yet i want to find the available "free" letters.
I am not sure on how to use the GetLogicalDrives.
There is also a GetLogicalDriveStrings API.
I don't know how to use either of them.
Could you show me examples of both statements?

Thanks :)
var dw1 : dword;
    ch1 : char;
  dw1 := GetLogicalDrives;
  for ch1 := 'A' to 'Z' do
    if not odd(dw1 shr (ord(ch1) - ord('A'))) then begin
      // drive [ch1]: is free

Don't know about GetLogicalDriveStrings.

Regards, Madshi.

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
waipahuAuthor Commented:
Thanks Madshi!!!!
Very good!!! It works

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

From novice to tech pro — start learning today.