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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

path problem 1

Status
Not open for further replies.

fluppeke

Programmer
Aug 30, 2006
38
BE
Hey Guys,

My problem,

I have many users on my server.
The all get drive letters in which they can search
I made program in which i make a connection to an xls file
for 1 user it is h:\xxx\aaa.xls
for user 2 it is i:\xxx\zzz\aaa.xls
how can i get the path which is on de server: \\s001\d\blabla\aaa.xls

Any suggetions ???

with friendly greetins,

FILIP MERLIER
 
VFP can use UNC paths. So you just can use:
IMPORT/EXPORT or whatever action you want that way:
Code:
IMPORT FROM \\ServerName\SharedFolderOrDiskName\SubFolder\NameofXSLFile.XLS XL8

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Hello Borislav,

I don't think you understoud me well.
In my form there is a place for the path and the extension
So I place h:\xxx.xls but I want to change it in \\s001\d\technical\xxx.xls so that everyone can call this xls file from my form and open it.

with friendly greetings,

FILIP MERLIER
 
Again I can't understand you. What is the problem? If you have a place where you set the path why not set it like you want?
\\s001\d\technical\ instead of h:\

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Hey Borislav,

the problem is that for user 1 h=\\s001\d\xxx\yyy\aaa.xls
user 2 user i:\aaa.xls

so i want to change h into \\s001\d\xxx\yyy\aaa.xls and also
for user 2 i=\\s001\d\xxx\yyy\aaa.xls

with friendly greatings
I work with vfp7 sp1

FILIP MERLIER
 
OK, let start from the beginning:

1. How you set the path?

2. Did you have some routine where you write that path to local station?

3. Did the user choose the path or you write it for him/her?

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Hey borislav

I have a form in within the users picks an xls file with the getfile function.

So what I want is to change that path the getfile gives into the server path

with friendly greatings

Filip merlier
 
Hurray! Finaly I understand :)

Try this:

Code:
? GetUNCfromDriveLetter([H:\])
? GetUNCfromDriveLetter([I:\])

FUNCTION GetUNCfromDriveLetter(cDriveLetterToCheck)
LOCAL cBuffer, nResult
IF VARTYPE(cDriveLetterToCheck) # [C]    OR ;
   LEN(cDriveLetterToCheck) < 2          OR ;
   SUBSTR(cDriveLetterToCheck,2,1) # [:] OR ;
   NOT BETWEEN(UPPER(LEFT(cDriveLetterToCheck,1)),'A','Z')
   RETURN ''
ENDIF

DECLARE INTEGER WNetGetConnection IN Win32API ;
   STRING   @cLocalDrive, ;
   STRING   @cRemoteUNCBuffer, ;
   INTEGER  @nSizeOfBuffer
cBuffer = SPACE(511)
nResult = WNetGetConnection(LEFT(cDriveLetterToCheck,2), ;
                            @cBuffer, ;
                            511)
IF nResult # 0
   *  Failed - it's probably not a mapped drive,
   *  or nothing is mapped to it
   RETURN ''
ELSE
   RETURN LEFT(cBuffer,AT(CHR(0),cBuffer)-1)
ENDIF

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Mr. Borislav,

your get a star from me for this fine solution

FILIP MERLIER
 
Enumerate Available Shares and Current Mapping faq184-4449
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top