Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WNetGetConnection woes
Message
From
20/05/2011 15:43:18
 
 
To
All
General information
Forum:
ASP.NET
Category:
Troubleshooting
Title:
WNetGetConnection woes
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01511311
Message ID:
01511311
Views:
91
I am getting an unexpected error when calling a know API function. "Unable to find an entry point named 'WNetGetConnection' in DLL 'mpr.dll'."

Here is the text code that reproduces the error on my machine. Am I missing some Reference or something? All web articles make no mention of needing anything but the declaration at the top of the code. (p.s. the mapped drive does exist.)
Imports System.IO


Module Module1
    Public Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnection" (ByVal localName As String, ByVal remoteName As Text.StringBuilder, ByRef length As Integer) As Integer

    Sub Main()


        Dim lcDrive As String = "Y:"
        Dim lnresult As Integer = 0

        Dim lcUNCBuffer = New Text.StringBuilder(1025)
        Dim lnLength = 1024

        lnresult = WNetGetConnection(lcDrive, lcUNCBuffer, lnLength)
        Console.WriteLine(lnresult)
        Console.WriteLine(lcUNCBuffer.ToString)
    End Sub

End Module
Greg Reichert
Next
Reply
Map
View

Click here to load this message in the networking platform