public class ConnectSharedFolder
{
public struct NETRESOURCE
{
public int dwScope;
public int dwType;
public int dwDisplayType;
public int dwUsage;
public string lpLocalName;
public string lpRemoteName;
public string lpComment;
public string lpProvider;
}
[DllImport("mpr.dll", CharSet = CharSet.Ansi, EntryPoint = "WNetAddConnection2A", ExactSpelling = true, SetLastError = true)]
public static extern int WNetAddConnection2(ref ConnectSharedFolder.NETRESOURCE lpNetResource, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpPassword, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpUserName, int dwFlags);
[DllImport("mpr.dll", CharSet = CharSet.Ansi, EntryPoint = "WNetCancelConnection2A", ExactSpelling = true, SetLastError = true)]
public static extern int WNetCancelConnection2([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpName, int dwFlags, int fForce);
public bool BeginConnect(string
C#代码:映射网络磁盘
最新推荐文章于 2024-04-14 00:49:00 发布