对win98可以, win2000局域网没有试验过
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String ' only used if FOF_SIMPLEPROGRESS
End Type
Const FO_COPY = &H2
Const FOF_SIMPLEPROGRESS = &H100
Private Sub Command1_Click()
Dim fileOp As SHFILEOPSTRUCT
Dim rtn As Long
rtn = WNetAddConnection("\\Class05\xxl", "111", "") '111为password
With fileOp
.hwnd = Me.hwnd
.wFunc = FO_COPY
.pFrom = "D:\11.swf"
.pTo = "\\Class05\xxl"
.fFlags = FOF_SIMPLEPROGRESS
End With
rtn = SHFileOperation(fileOp)
End Sub
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String ' only used if FOF_SIMPLEPROGRESS
End Type
Const FO_COPY = &H2
Const FOF_SIMPLEPROGRESS = &H100
Private Sub Command1_Click()
Dim fileOp As SHFILEOPSTRUCT
Dim rtn As Long
rtn = WNetAddConnection("\\Class05\xxl", "111", "") '111为password
With fileOp
.hwnd = Me.hwnd
.wFunc = FO_COPY
.pFrom = "D:\11.swf"
.pTo = "\\Class05\xxl"
.fFlags = FOF_SIMPLEPROGRESS
End With
rtn = SHFileOperation(fileOp)
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货