Keep in mind that WnetGetConnection will only return the UNC path for a mapped drive, not just any drive. The program below will show the UNC name for the mapped Q: drive.
Module Module1 Public Declare Function WNetGetConnection Lib "mpr.dll" Alias _ "WNetGetConnectionA" (ByVal lpszLocalName As String, _ ByVal lpszRemoteName As String, ByRef cbRemoteName As Integer) As Integer Sub Main() Dim ret As Integer Dim out As String = New String(" ", 260) Dim len As Integer = 260 ret = WNetGetConnection("Q:", out, len) Console.WriteLine(out) End Sub End Module
Dig Deeper on Win Development Resources
Related Q&A from John Robbins
What is a JAD session? This term is referred to often in job postings and seems like some kind of brainstorm you carry out with a client to define IT... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.