Solved

Get UNC from mapped drive

Posted on 2004-08-24
6
471 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Opening and Closing Connections and Data Adapters 10 49
VB.NET (2008) - Refactoring Question 2 19
Store results in vb.net 3 20
Expression Evaluater 3 24
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

815 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

8 Experts available now in Live!

Get 1:1 Help Now