version 5.00
begin vb.form form1
caption = "form1"
clientheight = 3195
clientleft = 60
clienttop = 345
clientwidth = 4680
linktopic = "form1"
scaleheight = 3195
scalewidth = 4680
startupposition = 3 '視窗預設
begin vb.textbox text1
height = 360
left = 1260
tabindex = 1
top = 1110
width = 2475
endbegin vb.commandbutton command1
caption = "command1"
height = 390
left = 1515
tabindex = 0
top = 2220
width = 1620
endbegin vb.label label1
autosize = -1 'true
backstyle = 0 'transparent
caption = "路徑:"
height = 180
left = 525
tabindex = 2
top = 1125
width = 540
endend
attribute vb_name = "form1"
attribute vb_globalnamespace = false
attribute vb_creatable = false
attribute vb_predeclaredid = true
attribute vb_exposed = false
option explicit
private
const connect_update_profile =
private
const resource_connected as
long = &h1
private
const resource_globalnet as
long = &h2
private
const resourcetype_disk as
long = &h1
private
const resourcedisplaytype_share& =
private
const resourceusage_connectable as
long = &h1
private
declare
function wnetaddconnection2 lib
"mpr.dll"
alias
"wnetaddconnection2a" (lpnetresource as netconnect, byval lppassword as
string, byval lpusername as
string, byval dwflags as
long) as
long
private type netconnect
dwscope as
long
dwtype as
long
dwdisplaytype as
long
dwusage as
long
lplocalname as
string
lpremotename as
string
lpcomment as
string
lpprovider as
string
end type
public
function mapdrive(localdrive as
string, remotedrive as
string, optional username as
string, optional password as
string) as
boolean
dim netr as netconnect
netr.dwscope = resource_globalnet
netr.dwtype = resourcetype_disk
netr.dwdisplaytype = resourcedisplaytype_share
netr.dwusage = resourceusage_connectable
netr.lplocalname = left$(localdrive, 1) & ":"
netr.lpremotename = remotedrive
mapdrive = (wnetaddconnection2(netr, username, password, connect_update_profile) = 0)
endfunction
private
sub command1_click()
if mapdrive("i:", text1.text) then
msgbox "對映網路驅動器成功"
else
msgbox "對映網路驅動器失敗"
endif
endsub
C 磁碟對映
c 執行 cmd 命令使用 system 函式,執行成功,函式返回值為 0,失敗返回值為 非零值。如果磁碟已經對映,再次對映,會拋錯,所以,在程式退出之前需要刪除磁碟對映。磁碟對映命令 net use z serverurl user serveruser serverpassword z 後面需要...
網路磁碟對映
linux window 1 在liux下建立共享資料夾 2 訪問 3 選中資料夾,右鍵,磁碟對映 window linux 1 在window下建立共享資料夾 2 在 mnt下建立win資料夾 3 掛載 本地掛載 mount dev sda1 mnt usb 網路掛載 mount.cifs hom...
磁碟對映與埠對映
對映網路驅動器 就是把在其它電腦上的乙個共享資料夾變為自己電腦上的乙個邏輯驅動器符,以供使用方便。對映網路驅動器 的意思是將區域網中的某個目錄對映成本地驅動器號,就是說把網路上其他機器的共享的資料夾對映自己機器上的乙個磁碟,這樣可以提高訪問時間。對映網路驅動器 就是把在其它電腦上的乙個共享資料夾變為...