Manage Learn to apply best practices and optimize your operations.

How You Can Find Nsf Files With A Window Directory

Sometimes the people who works with Lotus Notes would like to have a way to get
the NSF files by selecting a directory.
Here you have the way to show you the complete directory of you computer and
select an especific directory.
'Here the declarations.
Public Const INVALID_HANDLE_VALUE = -1
Public Const MAX_PATH = 260
Public Const BIF_RETURNONLYFSDIRS = 1
Public Const BIF_DONTGOBELOWDOMAIN = 2


Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type

Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type

Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type


Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Declare Function SHGetPathFromIDList Lib "shell32" (Byval pidList As Long,
Byval lpBuffer As String) As Long
Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (Byval lpString1
As String, Byval lpString2 As String) As Long

Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (Byval
lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (Byval
hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Declare Function FindClose Lib "kernel32" (Byval hFindFile As Long) As Long




'Here you can put the code in any button or action.

Sub Click(Source As Button)
Dim Newdb As notesdatabase
Dim WFD As WIN32_FIND_DATA
Dim tBrowseInfo As BrowseInfo
Dim r As Long
Dim hFile As Long
Dim bNext As Long
Dim fCount As Long
Dim numFiles As Long
Dim lpIDList As Long
Dim currFile As String
Dim sSourcePath As String
Dim sDestination As String
Dim sFileType As String
Dim sBuffer As String
Dim szTitle As String
Dim Array() As String


szTitle = "Click on a directory and " & _
"it's path will be displayed in a message box"
' Text to appear in the the gray area under the title bar
' telling you what to do

tBrowseInfo.hWndOwner = hWnd ' Owner Form
tBrowseInfo.lpszTitle = lstrcat(szTitle, "")
tBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN

lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sBuffer = Space(MAX_PATH)
paso = SHGetPathFromIDList( lpIDList, sBuffer)
sBuffer = Left(sBuffer, Instr(sBuffer, Chr$(0)) -
1)
Else
Exit Sub
End If

'Search the NSF in the selecting directory
sSourcePath = sBuffer & "\"
sFileType = "*.nsf"

'Start searching for files in the Source directory by
'obtaining a file handle to the first file matching the 'filespec passed

hFile = FindFirstFile(sSourcePath & sFileType, WFD)

If (hFile = INVALID_HANDLE_VALUE) Then 'no match, so bail out
Msgbox "i didn't find files *nsf"
Exit Sub
End If
'must have at least one, so ... If hFile Then

x = 0
Do
'increment the counter and find the next
'file matching the filespec fCount = fCount + 1
' Msgbox WFD.cFileName
Redim Preserve Array(x)
Array(x) = WFD.cFileName
bNext = FindNextFile(hFile, WFD)
x = x +1
Loop Until bNext = 0

r = FindClose(hFile) 'return the number of files found

'obtain the ti
This was last published in November 2000

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close