- VERSION5.00
- BeginVB.FormForm1
- Caption="Form1"
- ClientHeight=3195
- ClientLeft=60
- ClientTop=345
- ClientWidth=4680
- LinkTopic="Form1"
- ScaleHeight=3195
- ScaleWidth=4680
- StartUpPosition=3'窗口缺省
- BeginVB.TextBoxText1
- Height=360
- Left=1260
- TabIndex=1
- Top=1110
- Width=2475
- End
- BeginVB.CommandButtonCommand1
- Caption="Command1"
- Height=390
- Left=1515
- TabIndex=0
- Top=2220
- Width=1620
- End
- BeginVB.LabelLabel1
- AutoSize=-1'True
- BackStyle=0'Transparent
- Caption="路径:"
- Height=180
- Left=525
- TabIndex=2
- Top=1125
- Width=540
- End
- End
- AttributeVB_Name="Form1"
- AttributeVB_GlobalNameSpace=False
- AttributeVB_Creatable=False
- AttributeVB_PredeclaredId=True
- AttributeVB_Exposed=False
- OptionExplicit
- PrivateConstCONNECT_UPDATE_PROFILE=
- PrivateConstRESOURCE_CONNECTEDAsLong=&H1
- PrivateConstRESOURCE_GLOBALNETAsLong=&H2
- PrivateConstRESOURCETYPE_DISKAsLong=&H1
- PrivateConstRESOURCEDISPLAYTYPE_SHARE&=
- PrivateConstRESOURCEUSAGE_CONNECTABLEAsLong=&H1
- PrivateDeclareFunctionWNetAddConnection2Lib"mpr.dll"Alias"WNetAddConnection2A"(lpNetResourceAsNETCONNECT,ByVallpPasswordAsString,ByVallpUserNameAsString,ByValdwFlagsAsLong)AsLong
- PrivateTypeNETCONNECT
- dwScopeAsLong
- dwTypeAsLong
- dwDisplayTypeAsLong
- dwUsageAsLong
- lpLocalNameAsString
- lpRemoteNameAsString
- lpCommentAsString
- lpProviderAsString
- EndType
- PublicFunctionMapDrive(LocalDriveAsString,RemoteDriveAsString,OptionalUsernameAsString,OptionalPasswordAsString)AsBoolean
- DimNetRAsNETCONNECT
- 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
- PrivateSubCommand1_Click()
- IfMapDrive("I:",Text1.Text)Then
- MsgBox"映射网络驱动器成功"
- Else
- MsgBox"映射网络驱动器失败"
- EndIf
- EndSub