wnetaddconnection3 (mpr)
Last changed: 220.10.204.141

.
Summary
The WNetAddConnection3 function makes a connection to a network resource. The function can redirect a local device to the network resource.

The WNetAddConnection3 function is similar to the WNetAddConnection2 function. The main difference is that WNetAddConnection3 has an additional parameter, a handle to a window that the provider of network resources can use as an owner window for dialog boxes. The WNetAddConnection2 function and the WNetAddConnection3 function supersede the WNetAddConnection function.

C# Signature:

// NETRESOURCE defined as struct
  [DllImport("mpr.dll", CharSet=CharSet.Auto, SetLastError=true)]
  public static extern int WNetAddConnection3(
    [In] IntPtr handleToOwnerWindow,
    [In] ref NETRESOURCE netResource,
    [In] string password,
    [In] string userName,
    [In] int flags);

// NETRESOURCE defined as class
  [DllImport("mpr.dll", CharSet=CharSet.Auto, SetLastError=true)]
  public static extern int WNetAddConnection3(
    [In] IntPtr handleToOwnerWindow,
    [In] NETRESOURCE netResource,
    [In] string password,
    [In] string userName,
    [In] int flags);

VB .NET Signature:

Declare Function WNetAddConnection3 Lib "mpr.dll" (TODO) As TODO

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

C#

If you define WNetAddConnection3 then the signature for WNetAddConnection2 can be

public static int WNetAddConnection2(
   NETRESOURCE netResource,
   string password,
   string username,
   int flags)
{
   return(WNetAddConnection3(null, netResource, password, username, flags);
}

Sample Code:

Please add some!

Alternative Managed API:

TODO

Documentation