内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

vb.net共享方法 vbnet shared

vb中怎麼把文件夾設(shè)為共享

NET SHARE命令設(shè)置共享路徑,如將D盤設(shè)為共享

創(chuàng)新互聯(lián)從2013年成立,先為儋州等服務(wù)建站,儋州等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為儋州企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問(wèn)題。

所以你可以使用shell "net share D$"

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

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

如果能生成就沒(méi)問(wèn)題。

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

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

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

在目標(biāo)服務(wù)器建立共享文件夾,建立訪問(wèn)賬號(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.net?怎么實(shí)現(xiàn)多個(gè)控件共同使用一個(gè)變量

把變量定義時(shí)增加Shared關(guān)鍵字即可.如:

Private

Shared

AAA

As

String

Public

Shared

AAA

As

String

......

這樣AAA在一個(gè)應(yīng)用程序里就是公用的.

------------------------------------------------------

補(bǔ)充:

不可能沒(méi)用,我都是這樣做的.

該控件使用中,自己看吧:

Public

Class

CMB_MemoryTextBox

Inherits

TextBox

#Region

"

變量定義

"

Private

Shared

p_HisData

As

STRU_DATA

'用數(shù)據(jù)表保存所有控件的歷史記錄

Private

Shared

p_FileName

As

String

'保存歷史記錄的文件名

......

vb.net里面老是看到什么“共享方法”“共享屬性”是什么意思?

可以直接從類調(diào)用共享方法,而不必首先創(chuàng)建該類的實(shí)例。共享屬性與之類似,可以在一創(chuàng)建類實(shí)例的情況下訪問(wèn),并且即使有了多個(gè)實(shí)例,共享屬性仍然只有一個(gè),就是說(shuō),設(shè)置了該屬性后,對(duì)所有實(shí)例有效。類似于全局變量。

使用vb.net將以太網(wǎng)共享給虛擬wifi網(wǎng)絡(luò)

最簡(jiǎn)單的辦法是用句柄操作窗體,這種方法就好比是計(jì)算機(jī)在代替你在打開(kāi)設(shè)置窗口,完成設(shè)置。

比較難實(shí)現(xiàn)的方法是用API,不過(guò)我不知道用那些API,而且還要驅(qū)動(dòng)支持

因?yàn)関b。net是高級(jí)語(yǔ)言,不能直接操作驅(qū)動(dòng),所以直接寫(xiě)匯編是不可行的

新聞名稱:vb.net共享方法 vbnet shared
網(wǎng)站鏈接:http://m.rwnh.cn/article26/hiepcg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、網(wǎng)站營(yíng)銷、動(dòng)態(tài)網(wǎng)站、云服務(wù)器、搜索引擎優(yōu)化、App開(kāi)發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)
普陀区| 易门县| 上蔡县| 霍山县| 绍兴县| 信丰县| 承德县| 南陵县| 肥乡县| 湘潭市| 开封县| 囊谦县| 志丹县| 浑源县| 永城市| 浪卡子县| 个旧市| 兴隆县| 新和县| 宝丰县| 磴口县| 宁陕县| 金坛市| 丰顺县| 克东县| 志丹县| 东阿县| 商城县| 河曲县| 临邑县| 永德县| 绥宁县| 四会市| 东乡族自治县| 洪湖市| 孝感市| 济南市| 金门县| 土默特左旗| 革吉县| 仪征市|