Best Practices > Diskussionen zu Best Practices
Filesystem Klasse unter LS
Axel:
--- Zitat von: Johnson am 09.12.05 - 13:37:09 ---zu Punkt 3:
Reichen die Funktionen SaveFileDialog und OpenFileDialog des NotesUIWorkspace-Objekts nicht aus?
--- Ende Zitat ---
Im Prinzip schon. Nur ich verwende gerne, wenn es nur um die Auswahl eines Verzeichnisses geht die Funktion BrowseForFolder. Ich bin eigentlich auch gerne, wenn's sich machen lässt, Windows-konform.
Axel
Johnson:
Solange es nur Clients unter Windows gibt.
Remane - Problem:
Das Statement "Name" in LS scheint bugy zu sein. Zumindest R6.5.4 auf Windows XP (SP2).
Die Datei bleibt nach dem Umbenennen bis zum Verlassen von Notes gelockt. ???
Johnson:
--- Zitat von: Axel am 09.12.05 - 14:08:36 ---Im Prinzip schon. Nur ich verwende gerne, wenn es nur um die Auswahl eines Verzeichnisses geht die Funktion BrowseForFolder. Ich bin eigentlich auch gerne, wenn's sich machen lässt, Windows-konform.
--- Ende Zitat ---
Unteranderem auch die Funktionen DlgNetworkComputer und DlgNetworkShare:
--- Code: ---
' ### constants ###
' DlgNetworkShare / DlgNetworkComputer
Private Const ERROR_SUCCESS = 0
Private Const MAX_PATH = 260
Private Const CSIDL_NETWORK = &H12
Private Const BIF_RETURNONLYFSDIRS = &H1
Private Const BIF_BROWSEFORCOMPUTER = &H1000
Private Const DLG_NETWORKSHARE_TITLE = "Bitte wählen Sie eine Freigabe aus!"
Private Const DLG_NETWORKCOMPUTER_TITLE = "Bitte wählen Sie einen Computer aus!"
' ### user defined types ###
' BrowseInfo
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 Long
End Type
' ### external functions ###
' This function converts an item identifier list to a file system path.
Declare Private Function apiSHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (Byval pidl As Long, Byval pszPath As String) As Long
' This function retrieves the location of a special folder, such as My Handheld PC, Recycle Bin, Control Panel, Desktop, Printers, Fonts, or various file system directories.
Declare Private Function apiSHGetSpecialFolderLocation Lib "shell32.dll" Alias "SHGetSpecialFolderLocation" (Byval hwndOwner As Long, Byval nFolder As Long, pidl As Long) As Long
' This function displays a dialog box that allows a user to select a folder.
Declare Private Function apiSHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Public Function DlgNetworkComputer As String
Dim bi As BrowseInfo
Dim lng_pidl As Long
If apiSHGetSpecialFolderLocation(0, CSIDL_NETWORK, lng_pidl) = ERROR_SUCCESS Then
bi.hOwner = 0
bi.pidlRoot = lng_pidl
bi.pszDisplayName = Space$(MAX_PATH)
bi.lpszTitle = DLG_NETWORKCOMPUTER_TITLE
bi.ulFlags = BIF_BROWSEFORCOMPUTER
If apiSHBrowseForFolder(bi) <> 0 Then
DlgNetworkComputer = "\\" & Left$(bi.pszDisplayName,Instr(bi.pszDisplayName,Chr$(0)) - 1)
End If
End If
End Function
Public Function DlgNetworkShare As String
Dim bi As BrowseInfo
Dim lng_pidl As Long
Dim str_path As String
Dim lng_return As Long
If apiSHGetSpecialFolderLocation(0, CSIDL_NETWORK, lng_pidl) = ERROR_SUCCESS Then
bi.hOwner = 0
bi.pidlRoot = lng_pidl
bi.pszDisplayName = Space$(MAX_PATH)
bi.lpszTitle = DLG_NETWORKSHARE_TITLE
bi.ulFlags = BIF_RETURNONLYFSDIRS
lng_pidl = apiSHBrowseForFolder(bi)
If lng_pidl <> 0 Then
str_path = Space$(MAX_PATH)
If apiSHGetPathFromIDList(Byval lng_pidl, Byval str_path) Then
DlgNetworkShare = Left$(str_path, Instr(str_path, Chr$(0)) - 1) ' folder on host
Else
DlgNetworkShare = "\\" & Left$(bi.pszDisplayName, Instr(bi.pszDisplayName,Chr$(0)) - 1) ' host only
End If
End If
End If
End Function
--- Ende Code ---
Johnson:
Hab ´nen kleinen Bug gefunden und entfernt:
NotesFolder Property hatte die falsche Funktion des FileSystemObjects aufgerufen.
http://atnotes.de/index.php?action=dlattach;topic=27547.0;id=3226
Johnson:
So... es ist soweit: FileSystem 2.0 Beta ist fertig.
Bis auf Laufwerkgeschichten (GetDrive, GetDriveLetters etc.) sind laufen die Funktionen der FileSystem-Klasse auch auf UNIX-Systemen.
Diverse Einschränkungen musste ich natürlich als gegeben hinnehmen.
Zum Testen ist´s freigegeben.
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln