真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net共享文件夾 win建立共享文件夾

VB 訪問網(wǎng)絡(luò)共享文件夾并新建文件

網(wǎng)絡(luò)共享文件夾不能直接用VB里的Open語句,那是為本地文件用的

創(chuàng)新互聯(lián)公司是一家專業(yè)提供德保企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站制作、成都做網(wǎng)站、外貿(mào)營銷網(wǎng)站建設(shè)、成都h5網(wǎng)站建設(shè)、小程序制作等業(yè)務(wù)。10年已為德保眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站設(shè)計(jì)公司優(yōu)惠進(jìn)行中。

網(wǎng)絡(luò)文件夾用API函數(shù)OpenFile

具體用法:

FileHandle = OpenFile( "\\ " IP地址 文件路徑 "\ " 文件名, lpReOpenBuff, OF_READ)

Vb.net 請(qǐng)問如何快速時(shí)時(shí)讀取共享文件夾資料

File.WriteAllText("\\10.1.37.222\shared\temp.txt", "");

如果能生成就沒問題。

如果不用net use的方法,vb.net 有辦法訪問共享文件或者共享文件夾嗎

我不會(huì)VB,但是都是.net。c#的代碼稍微轉(zhuǎn)換一下就可以了。

C#實(shí)現(xiàn)訪問網(wǎng)絡(luò)共享文件夾,使用?WNetAddConnection2A?和?WNetCancelConnection2A。

在目標(biāo)服務(wù)器建立共享文件夾,建立訪問賬號(hào)test;

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?WNetCancelConnection2A?(string?sharename,?int?dwFlags,?int?fForce);

public?static?int?Connect?(string?remotePath,?string?localPath,?string?username,?string?password)

{

NETRESOURCE[]?share_driver?=?new?NETRESOURCE[1];

share_driver[0].dwScope?=?RESOURCE_SCOPE.RESOURCE_GLOBALNET;

share_driver[0].dwType?=?RESOURCE_TYPE.RESOURCETYPE_DISK;

share_driver[0].dwDisplayType?=?RESOURCE_DISPLAYTYPE.RESOURCEDISPLAYTYPE_SHARE;

share_driver[0].dwUsage?=?RESOURCE_USAGE.RESOURCEUSAGE_CONNECTABLE;

share_driver[0].lpLocalName?=?localPath;

share_driver[0].lpRemoteName?=?remotePath;

Disconnect(localPath);

int?ret?=?WNetAddConnection2A(share_driver,?password,?username,?1);

return?ret;

}

public?static?int?Disconnect?(string?localpath)

{

return?WNetCancelConnection2A(localpath,?1,?1);

}

調(diào)用方式:

public?static?void?TestNetWorkConnection()

{

string?localpath?=?"X:";

//int?status?=?NetworkConnection.Connect(@"\\192.168.0.2\test",?localpath,?@"test",?"test");

int?status?=?NetworkConnection.Connect("\\\\192.168.0.2\\test",?localpath,?@"test",?"test");

if?(status?==?(int)ERROR_ID.ERROR_SUCCESS)

{

FileStream?fs?=?new?FileStream(localpath?+?@"\\123.txt",?FileMode.OpenOrCreate);

using?(StreamWriter?stream?=?new?StreamWriter(fs))

{

stream.WriteLine("你好呀,成功了");

stream.Flush();

stream.Close();

}

fs.Close();

}

else

{

Console.WriteLine(status);

}

NetworkConnection.Disconnect(localpath);

}

vb如何開放本機(jī)文件夾在局域網(wǎng)之間的共享

你用regsnap或者regshot軟件快照下注冊(cè)表,再用深度那個(gè)工具修改下注冊(cè)表,再用regsnap或者regshot軟件快照下注冊(cè)表,對(duì)比下兩次的區(qū)別后,就能找到相關(guān)的注冊(cè)表項(xiàng)了,找到后用操作注冊(cè)表的API或者wscript更改掉相關(guān)的注冊(cè)項(xiàng)即可。

開啟或者關(guān)閉局域網(wǎng)共享的功能,其實(shí)就是更改注冊(cè)表相應(yīng)的鍵值。


分享名稱:vb.net共享文件夾 win建立共享文件夾
轉(zhuǎn)載來源:http://weahome.cn/article/hpecej.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部