title image


Smiley Re: Netzwerkcomputer in ListBox
Das hilft vielleicht!Option Explicit'**************************************************************************'strPath = BrowseFolder("Please choose a folder!", Me.hwnd)'strShare = BrowseNetworkShare("Please choose network share!", Me.hwnd)'strComputer = BrowseNetworkComputer("Please choose a computer!", Me.hwnd)'**************************************************************************Private Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As LongEnd TypePrivate Const ERROR_SUCCESS As Long = 0Private Const MAX_PATH As Long = 260Private Const CSIDL_NETWORK As Long = &H12Private Const BIF_RETURNONLYFSDIRS As Long = &H1Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As LongPrivate Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As LongPrivate Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As Long) As LongPublic Function BrowseFolder(strTitle As String, lngHwnd As Long) As StringDim bi As BROWSEINFODim lngListID As LongDim strPath As StringDim intPos As IntegerDim lngX As LongWith bi .hOwner = lngHwnd .lpszTitle = strTitle .ulFlags = BIF_RETURNONLYFSDIRSEnd WithlngListID = SHBrowseForFolder(bi)strPath = Space$(512)lngX = SHGetPathFromIDList(ByVal lngListID, ByVal strPath)If lngX Then intPos = InStr(strPath, Chr(0)) BrowseFolder = Left(strPath, intPos - 1)Else BrowseFolder = ""End IfEnd FunctionPublic Function BrowseNetworkShare(strTitle As String, lngHwnd As Long) As StringDim bi As BROWSEINFODim lngPidl As LongDim strPath As StringDim intPos As IntegerIf SHGetSpecialFolderLocation(lngHwnd, CSIDL_NETWORK, lngPidl) = ERROR_SUCCESS Then With bi .hOwner = lngHwnd .pidlRoot = lngPidl .pszDisplayName = Space$(MAX_PATH) .lpszTitle = strTitle .ulFlags = BIF_RETURNONLYFSDIRS End With lngPidl = SHBrowseForFolder(bi) If lngPidl 0 Then strPath = Space$(MAX_PATH) If SHGetPathFromIDList(ByVal lngPidl, ByVal strPath) Then intPos = InStr(strPath, Chr$(0)) BrowseNetworkShare = Left$(strPath, intPos - 1) End If Else BrowseNetworkShare = "\\" & bi.pszDisplayName End IfEnd IfEnd FunctionPublic Function BrowseNetworkComputer(strTitle As String, lngHwnd As Long) As StringDim bi As BROWSEINFODim lngPidl As LongIf SHGetSpecialFolderLocation(lngHwnd, CSIDL_NETWORK, lngPidl) = ERROR_SUCCESS Then With bi .hOwner = lngHwnd .pidlRoot = lngPidl .pszDisplayName = Space$(MAX_PATH) .lpszTitle = strTitle .ulFlags = BIF_BROWSEFORCOMPUTER End With If SHBrowseForFolder(bi) 0 Then BrowseNetworkComputer = "\\" & bi.pszDisplayName End IfEnd IfEnd Function-- ICQ: 79325032E-Mail: Fabian.Fischer@web.de(DH) PGP-Key on request

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: