获取网路碟机UNC路径
时 间:2008-10-13 19:26:20
作 者:danis ID:3378 城市:广州
摘 要:获取网路碟机UNC路径
正 文:
获取网路碟机UNC路径 Const NO_ERROR As Long = 0 Const ERROR_MORE_DATA As Long = 234 Const ERROR_BAD_DEVICE As Long = 1200 Const ERROR_NO_NETWORK As Long = 1222 Const ERROR_NOT_SUPPORTED As Long = 50 Const ERROR_NOT_CONNECTED As Long = 2250 Const ERROR_EXTENDED_ERROR As Long = 1208 Const ERROR_NO_NET_OR_BAD_PATH As Long = 1203 Const ERROR_CONNECTION_UNAVAIL As Long = 1201 Declare Function WNetGetConnectionA Lib "mpr.dll" (ByVal lpszLocalName As String, _ ByVal lpszRemoteName As String, cbRemoteName As Long) As Long Function GetUNCPath(ByVal strDriveLetter As String, ByRef strUNCPath As String) As Long On Local Error GoTo GetUNCPath_Err Dim strMsg As String Dim lngReturn As Long Dim strLocalName As String Dim strRemoteName As String Dim lngRemoteName As Long strLocalName = strDriveLetter strRemoteName = String$(255, Chr$(32)) lngRemoteName = Len(strRemoteName) lngReturn = WNetGetConnectionA(strLocalName, strRemoteName, lngRemoteName) If lngReturn = NO_ERROR Then GetUNCPath = NO_ERROR strUNCPath = Trim$(strRemoteName) strUNCPath = Left$(strUNCPath, Len(strUNCPath) - 1) Else GetUNCPath = lngReturn strUNCPath = strDriveLetter & "\" End If GetUNCPath_End: Exit Function GetUNCPath_Err: GetUNCPath = ERROR_NOT_SUPPORTED strUNCPath = strDriveLetter Resume GetUNCPath_End End Function Function Load_UNCPath() Dim strUNC As String If GetUNCPath("F:", strUNC) = NO_ERROR Then MsgBox "The UNC of the specified drive is " & strUNC Else MsgBox "There was a problem, sorry!" End If End Function
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
- 【Access选项卡示例】Ac...(09.09)
学习心得
最新文章
- 高效率在导入数据前删除记录(11.10)
- Access系统自带的日期选择器不...(11.08)
- 分享一下Access工程中的acw...(11.07)
- Access快速开发平台--让有权...(11.04)
- Access快速开发平台--审批选...(11.01)
- ACCESS两张表先各自排序,然后...(10.31)
- Access对子窗体数据进行批量+...(10.30)
- SqlServer中如何用SQL命...(10.29)
- Access报表中的分组功能用代码...(10.28)
- 用Access计算库存结余的一个方...(10.26)