[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

converting filename to truename... ??

Posted on 1998-03-25
2
Medium Priority
?
249 Views
Last Modified: 2010-04-06
Hello people,

if have a string which is a filename on drive h: for ex
strFilename := 'h:\ab\test.doc'

i'm on a network and i want to convert strFileName to a truename like '\\servername\sharename'

i use Windows.WNetGetConnection(PChar('h:'),PChar(strNetPath),dwMaxNetPathLen)
to get the truename of h:

but how do i put these two string together ???

'\\servername\share'
'h:\ab\test.doc'
to become
'\\servername\share\ab\test.doc'

i have tried some string operations. but i cannot get this to work.
0
Comment
Question by:mories
[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
2 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1360836
Hi,

Let

x := '\\servername\share';
y := 'h:\ab\test.doc' ;

The code for concatenating them is

fullname := x + System.Delete(y,1,2); //delete drive letter from y

Regards,
Igor
0
 
LVL 1

Accepted Solution

by:
RJENKINS earned 200 total points
ID: 1360837
If you are using D3 (D2?) try the function below:-


--- from help ---

ExpandUNCFileName(const FileName: string): string;

Description

The ExpandUNCFileName function returns a string containing a fully qualified path name for the file passed in the FileName. A fully qualified path name includes the drive portion of the filename in the UNC format '\\<servername>\<sharename>' if the drive letter is mapped to a network resource instead of a local drive and any directory and subdirectories in addition to the file name and extension.
Delphi programs can use this function to store filenames that are independent of a particular user's drive letter mappings.

--- end ---

Hope this helps
RCJ
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

649 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