Link to home
Start Free TrialLog in
Avatar of waipahu
waipahu

asked on

Mapping in delphi

I used the following command to map network drives:
   WNetAddConnection('\\rsg_prod\apps1','','K:');
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?

Thanks
Avatar of edey
edey

or using, say, z?
listening....

GL
Mike
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.
Avatar of waipahu

ASKER

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 :)
ASKER CERTIFIED SOLUTION
Avatar of Madshi
Madshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of waipahu

ASKER

Thanks Madshi!!!!
Very good!!! It works

thanks