How to get UNC path names?
Author Message
How to get UNC path names?

I need to be able to retrieve the name of the server that an application is
running on.  We are (trying to) use UNC and I need the application to be
able to determine where it is.
Example:
The application needs to know whether it is running on:
\\alpha\share1\  or \\bravo\share1\.

When the application is running all I have been able to see is that it is
run on d:\share1\  (The location on the machine but not the machine name).
I need to know if I am running on alpha or bravo.

HELP!!!

Sat, 11 Oct 2003 20:38:05 GMT
How to get UNC path names?
Will one of the environment settings return what you need?
Maybe:
Environ("LOGONSERVER")
or:
Environ("USERDOMAIN")

Rocky

Quote:
> I need to be able to retrieve the name of the server that an application
is
> running on.  We are (trying to) use UNC and I need the application to be
> able to determine where it is.
> Example:
> The application needs to know whether it is running on:
> \\alpha\share1\  or \\bravo\share1\.

> When the application is running all I have been able to see is that it is
> run on d:\share1\  (The location on the machine but not the machine name).
> I need to know if I am running on alpha or bravo.

> HELP!!!

Sat, 11 Oct 2003 20:47:49 GMT
How to get UNC path names?
Through code I am unsure.
I guess you could to a NET USE and retrieve the results, that would give you
any network mappings/locations that are being used.

--
Curt

(Remove NOSPAM for E-Mail Replies)
http://www.Darkfalz.com
---------------------------------------------------------------
** And The Geek Shall Inherit The Earth
---------------------------------------------------------------

Quote:
> I need to be able to retrieve the name of the server that an application
is
> running on.  We are (trying to) use UNC and I need the application to be
> able to determine where it is.
> Example:
> The application needs to know whether it is running on:
> \\alpha\share1\  or \\bravo\share1\.

> When the application is running all I have been able to see is that it is
> run on d:\share1\  (The location on the machine but not the machine name).
> I need to know if I am running on alpha or bravo.

> HELP!!!

Sat, 11 Oct 2003 20:51:12 GMT
How to get UNC path names?
Anthony,

Quote:
> We are (trying to) use UNC and I need the application to be
> able to determine where it is.

The sample UncName.zip may give you some ideas...
http://www.mvps.org/vb/index2.html

See the Shell Path Routines at this site:
http://www.mvps.org/vbnet/

HTH

-- Mark

Sat, 11 Oct 2003 16:51:25 GMT
How to get UNC path names?
You may find the following KB article of use:

HOWTO: Get UNC Path From a Mapped Network Share's Drive Letter[vbwin]
ID: Q192689
http://support.microsoft.com/support/kb/articles/q192/6/89.asp

Hope this helps,

===========================
Gray McDonald
Microsoft Developer Support
===========================

Sat, 11 Oct 2003 22:20:30 GMT
How to get UNC path names?
you can figure out the "pc"-name you are running on like this ..(Am I right
??)
one button ..

Private Declare Function APIGetComputerName Lib "Kernel32.dll" Alias
"GetComputerNameA" (ByVal lpBuffer$, nSize&) As Long Private Sub Command1_Click() Dim computername As String Dim sTmpString As String Dim lTmpLong As String sTmpString = Space$(1024) & Chr$(0) lTmpLong = APIGetComputerName(sTmpString, 1020) computername = sTmpString computername = Left(computername, InStr(computername, Chr(0)) - 1) msgbox computername End Sub Quote: > I need to be able to retrieve the name of the server that an application is > running on. We are (trying to) use UNC and I need the application to be > able to determine where it is. > Example: > The application needs to know whether it is running on: > \\alpha\share1\ or \\bravo\share1\. > When the application is running all I have been able to see is that it is > run on d:\share1\ (The location on the machine but not the machine name). > I need to know if I am running on alpha or bravo. > HELP!!! Sun, 12 Oct 2003 00:01:40 GMT How to get UNC path names? He needs the SERVER name though, not the workstation.....?? -- Curt (Remove NOSPAM for E-Mail Replies) http://www.Darkfalz.com --------------------------------------------------------------- ** And The Geek Shall Inherit The Earth --------------------------------------------------------------- Quote: > you can figure out the "pc"-name you are running on like this ..(Am I right > ??) > one button .. > Private Declare Function APIGetComputerName Lib "Kernel32.dll" Alias > "GetComputerNameA" (ByVal lpBuffer$, nSize&) As Long

> Private Sub Command1_Click()
>     Dim computername As String

>     Dim sTmpString As String
>     Dim lTmpLong As String

>     sTmpString = Space$(1024) & Chr$(0)
>     lTmpLong = APIGetComputerName(sTmpString, 1020)
>     computername = sTmpString
>     computername = Left(computername, InStr(computername, Chr(0)) - 1)
>     msgbox computername
> End Sub

> > I need to be able to retrieve the name of the server that an application
> is
> > running on.  We are (trying to) use UNC and I need the application to be
> > able to determine where it is.
> > Example:
> > The application needs to know whether it is running on:
> > \\alpha\share1\  or \\bravo\share1\.

> > When the application is running all I have been able to see is that it
is
> > run on d:\share1\  (The location on the machine but not the machine
name).
> > I need to know if I am running on alpha or bravo.

> > HELP!!!

Sun, 12 Oct 2003 01:15:50 GMT
How to get UNC path names?
I think WNetGetConnection is what he is looking for, API-wise.

--
MichKa

the only book on internationalization in VB at
http://www.i18nWithVB.com/

Quote:
> He needs the SERVER name though, not the workstation.....??

> --
> Curt

> (Remove NOSPAM for E-Mail Replies)
> http://www.Darkfalz.com
> ---------------------------------------------------------------
> ** And The Geek Shall Inherit The Earth
> ---------------------------------------------------------------

> > you can figure out the "pc"-name you are running on like this ..(Am I
> right
> > ??)
> > one button ..

> > Private Declare Function APIGetComputerName Lib "Kernel32.dll" Alias
> > "GetComputerNameA" (ByVal lpBuffer$, nSize&) As Long > > Private Sub Command1_Click() > > Dim computername As String > > Dim sTmpString As String > > Dim lTmpLong As String > > sTmpString = Space$(1024) & Chr\$(0)
> >     lTmpLong = APIGetComputerName(sTmpString, 1020)
> >     computername = sTmpString
> >     computername = Left(computername, InStr(computername, Chr(0)) - 1)
> >     msgbox computername
> > End Sub

> > > I need to be able to retrieve the name of the server that an
application
> > is
> > > running on.  We are (trying to) use UNC and I need the application to
be
> > > able to determine where it is.
> > > Example:
> > > The application needs to know whether it is running on:
> > > \\alpha\share1\  or \\bravo\share1\.

> > > When the application is running all I have been able to see is that it
> is
> > > run on d:\share1\  (The location on the machine but not the machine
> name).
> > > I need to know if I am running on alpha or bravo.

> > > HELP!!!

Sun, 12 Oct 2003 01:22:33 GMT

 Page 1 of 1 [ 8 post ]

Relevant Pages