Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert local path to UNC path if inside a share

Status
Not open for further replies.

TimSNL

Programmer
Sep 11, 2001
119
AU
Hello all.

Im trying to convert a local path to a unc path, if the path specified is part of a share.
Eg.
Assuming
1. The computer name is COMP
2. The folder C:\dir1\dir2 is shared with share name ABC
The local path i have is C:\dir1\dir2\test.txt
I need to be able to work out that the unc path is
\\COMP\ABC\test.txt

I have examined the post below but the answer does not seem to cover what I need:

Im using D6 and my app needs to run on W98 and up.

Thanks for reading my question.
Tim



---------------------------------------
The maggotts always win.
 
No function able to do that to the best of my knowledge.

It is quite complicated, you need to list all the shares (using GetShareEnum) and check against your local path (C:\dir1\dir2\test.txt) to find a matching share (if any). After that, you can do the needed cuts and replaces in the local path.

buho (A).
 
I dont know about D6 but D7 has TShellTreeview and TShellListview components on the Samples Tab, these components obliviate most of the API calls that are otherwise required and can handle both types of 'File path' syntax (though I think, not simultaniously).



Steve: Delphi a feersum engin indeed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top