资源简介
C#访问共享文件夹的类,共享给大家使用。。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace ConnectNetShare
{
public enum ERROR_ID
{
ERROR_SUCCESS = 0 // Success
ERROR_BUSY = 170
ERROR_MORE_DATA = 234
ERROR_NO_BROWSER_SERVERS_FOUND = 6118
ERROR_INVALID_LEVEL = 124
ERROR_ACCESS_DENIED = 5
ERROR_INVALID_PASSWORD = 86
ERROR_INVALID_PARAMETER = 87
ERROR_BAD_DEV_TYPE = 66
ERROR_NOT_ENOUGH_MEMORY = 8
ERROR_NETWORK_BUSY = 54
ERROR_BAD_NETPATH = 53
ERROR_NO_NETWORK = 1222
ERROR_INVALID_HANDLE_STATE = 1609
ERROR_EXTENDED_ERROR = 1208
ERROR_DEVICE_ALREADY_REMEMBERED = 1202
ERROR_NO_NET_OR_BAD_PATH = 1203
}
public enum RESOURCE_SCOPE
{
RESOURCE_CONNECTED = 1
RESOURCE_GLOBALNET = 2
RESOURCE_REMEMBERED = 3
RESOURCE_RECENT = 4
RESOURCE_CONTEXT = 5
}
public enum RESOURCE_TYPE
{
RESOURCETYPE_ANY = 0
RESOURCETYPE_DISK = 1
RESOURCETYPE_PRINT = 2
RESOURCETYPE_RESERVED = 8
}
public enum RESOURCE_USAGE
{
RESOURCEUSAGE_CONNECTABLE = 1
RESOURCEUSAGE_CONTAINER = 2
RESOURCEUSAGE_NOLOCALDEVICE = 4
RESOURCEUSAGE_SIBLING = 8
RESOURCEUSAGE_ATTACHED = 16
RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED)
}
public enum RESOURCE_DISPLAYTYPE
{
RESOURCEDISPLAYTYPE_GENERIC = 0
RESOURCEDISPLAYTYPE_DOMAIN = 1
RESOURCEDISPLAYTYPE_SERVER = 2
RESOURCEDISPLAYTYPE_SHARE = 3
RESOURCEDISPLAYTYPE_FILE = 4
RESOURCEDISPLAYTYPE_GROUP = 5
RESOURCEDISPLAYTYPE_NETWORK = 6
RESOURCEDISPLAYTYPE_ROOT = 7
RESOURCEDISPLAYTYPE_SHAREADMIN = 8
RESOURCEDISPLAYTYPE_DIRECTORY = 9
RESOURCEDISPLAYTYPE_TREE = 10
RESOURCEDISPLAYTYPE_NDSCONTAINER = 11
}
[StructLayout(LayoutKind.Sequential)]
public struct NETRESOURCE
{
public RESOURCE_SCOPE dwScope;
public RESOURCE_TYPE dwType;
public RESOURCE_DISPLAYTYPE dwDisplayType;
public RESOURCE_USAGE dwUsage;
[MarshalAs(UnmanagedType.LPStr)]
public string lpLocalName;
[MarshalAs(UnmanagedType.LPStr)]
public string lpRemoteName;
[MarshalAs(UnmanagedType.LPStr)]
public string lpComment;
[MarshalAs(UnmanagedType.LPStr)]
public string lpProvider;
}
public class NetworkConnection
{
[DllImport(“mpr.dll“)]
public static extern int WNetAddConnection2A(NETRESOURCE[] lpNetResource string lpPassword string lpUserName int dwFlags);
[DllImport(“mpr.dll“)]
public static extern int WNetCancelCo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7168 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\bin\Debug\ConnectNetShare.dll
文件 11776 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\bin\Debug\ConnectNetShare.pdb
文件 3965 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\ConnectNetShare.cs
文件 2268 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\ConnectNetShare.csproj
文件 553 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\obj\Debug\ConnectNetShare.csproj.FileListAbsolute.txt
文件 994 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\obj\Debug\ConnectNetShare.csprojResolveAssemblyReference.cache
文件 7168 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\obj\Debug\ConnectNetShare.dll
文件 11776 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\obj\Debug\ConnectNetShare.pdb
文件 6049 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 1350 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\Properties\AssemblyInfo.cs
文件 935 2013-09-24 10:43 ConnectNetShare\ConnectNetShare.sln
..A..H. 24576 2013-09-24 11:18 ConnectNetShare\ConnectNetShare.v11.suo
目录 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\obj\Debug\TempPE
目录 0 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\bin\Debug
目录 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\bin\Release
目录 0 2013-09-24 11:09 ConnectNetShare\ConnectNetShare\obj\Debug
目录 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\bin
目录 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\obj
目录 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare\Properties
目录 0 2013-09-24 10:43 ConnectNetShare\ConnectNetShare
目录 0 2013-09-24 10:43 ConnectNetShare
----------- --------- ---------- ----- ----
78578 24
- 上一篇:c# 校验文本是否为合法json格式
- 下一篇:C# 生成PDF源码
相关资源
- C#初级不涉及数据库的学生成绩管理系
- C#制作PDF以及源代码.rar
- 单像空间后方交会C#版
- C# Excel导入导出
- 适合于WinCE应用开发的压缩解压缩库
- C#监控剪切板
- 对C#的树型控件TREEVIEW添加背景图片
- 用c#写的五子棋源代码
- C#中在picturebox中实时画矩形框
- C#在一块空间中鼠标中键操作图像
- C#制作qq截图自动框选功能
- 显示所有缓存 清除所有缓存 Asp.net(
- C#自动截屏/定时截屏/自动保存/快捷键
- C# 通过鼠标滚轮实现缩放图片和移动
- C# 动态生成RDLC报表
- C#调用考勤机API读取记录
- c# 真正的线控件直线、斜线而且不会
- C#写的 模拟 cmd界面
- c# winform 超漂亮按钮 控件
- C# 内存处理器、网络上行与下行实时
- 仿QQ的C#源码、仿QQ的C#源码
- C#版人机对弈五子棋
- MPU6050 实时图表上位机 C#
- C#编码实现的开心消消乐游戏
- C# 计算机行为监控
- 定时调用接口小工具.zip
- C#实现shp文件的读取和显示程序
- 国密算法SM2、SM3、SM4的C#源码
- C# 模拟电梯控制源码
- C#节点的使用.zip
评论
共有 条评论