Solved

Get UNC from mapped drive

Posted on 2004-08-24
6
469 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
  • 2
6 Comments
 
LVL 10

Accepted Solution

by:
prakash_prk earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
What is mpr.dll? Is it legacy code?
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
It is a Windows API library:

Multiple Provider Router DLL

Bob
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

11 Experts available now in Live!

Get 1:1 Help Now