?
Solved

Get UNC from mapped drive

Posted on 2004-08-24
6
Medium Priority
?
476 Views
Last Modified: 2010-04-23
How do I get the UNC of a mapped drive in VB.NET? I don't want to use unmanaged code, if possible.
0
Comment
Question by:dbnewbie
[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
6 Comments
 
LVL 10

Accepted Solution

by:
prakash_prk earned 200 total points
ID: 11879628
Hi
try this

Public Declare Function WNetGetConnection Lib "mpr.dll" Alias _
             "WNetGetConnectionA" (ByVal lpszLocalName As String, _
             ByVal lpszRemoteName As String, ByRef cbRemoteName As Integer) As Integer

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ret As Integer
        Dim out As String = New String(" ", 260)
        Dim len As Integer = 260

        ret = WNetGetConnection("Q:", out, len)
        Msgbox(out)

    End Sub

regards Prakash
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11880547
I don't think that you will find a native method, unless you get really, really clever.  This should work as advertised.

Bob
0
 

Author Comment

by:dbnewbie
ID: 11882533
What is mpr.dll? Is it legacy code?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11882896
It is a Windows API library:

Multiple Provider Router DLL

Bob
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

649 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