Solved

converting filename to truename... ??

Posted on 1998-03-25
2
214 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
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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

937 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now