Solved

converting filename to truename... ??

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

724 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