public static extern int WNetGetConnection([MarshalAs(UnmanagedType.LPTStr)] string localName, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder remoteName, ref int length);
VB Signature:
<DllImport("mpr.dll")> _
Shared Function WNetGetConnection(<MarshalAs(UnmanagedType.LPTStr)> ByVal localName As String, ByVal remoteName As StringBuilder, ByRef length As Integer) As Integer
End Function
User-Defined Types:
None.
Notes:
localName is the local name for the network resource (drive or printer)
remoteName is a string builder used to return the network name for the resource
If the call fails because the StringBuilder is not large enough, the call will return a value of 234, and the Length parameter will contain the required size.
Tips & Tricks:
Please add some!
Sample Code:
// This sample code assumes you currently have a drive mapped to p:
// Find out what remote device a local mapping is to
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
Click to read this page
10/2/2011 2:35:57 AM - txzhgh-89.110.151.174
ByRef is a VB keyword that specifies a variable to be passed as a parameter BY REFERENCE. In other words, the pointer to the variable is passed and any change to its value made within the function or sub will change its value outside the function/sub.