Solved

converting filename to truename... ??

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 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

14 Experts available now in Live!

Get 1:1 Help Now