Ecco il codice necessario preso in rete:
*********************************************
(Declarations)
Declare Private Function W32_NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" (Byval PathName As Lmbcs String, _
hDB As Integer) As Integer
Declare Private Function W32_DesignRefresh Lib "nnotes" Alias "DesignRefresh" _
(Byval ServerName As Lmbcs String, Byval hDB As Integer, Byval dwFlags As Long, _
Byval abortCheck As Integer, Byval messageProc As Integer) As Integer
Declare Private Function W32_NSFDbClose Lib "nnotes" Alias "NSFDbClose" (Byval hDB As Integer) As Integer
Sub Initialize
Dim s As New notesSession
Dim sourceDb As notesDatabase
Dim refreshServer As String
Dim destPath As String
Dim rc As Integer
Dim hDb As Integer
Set sourceDb = s.getDatabase("
refreshServer = "
On Error Resume Next
If Not sourceDb.isOpen Then Call sourceDb.open("", "") ' Make sure the source database exists
If Not sourceDb.isOpen Then Set sourceDb = Nothing
On Error Goto 0
If Err <> 0 Then Set sourceDb = Nothing
If sourceDb Is Nothing Then Exit Sub ' ==== Exit if source db doesn't exist or couldn't be opened ====
' Build the API path to the file
If sourceDb.server = "" Then
destPath = sourceDb.filePath
Else
destPath = sourceDb.server & "!!" & sourceDb.filePath
End If
rc = W32_NSFDbOpen(destPath, hDb) ' Open the db in the API and get a handle to the open db
If rc <> 0 Then ' Return Code zero on success, non-zero on failure
Msgbox "Database Could Not Be Opened - Error Code " & Cstr(rc), 16, "Error"
Else
rc = W32_DesignRefresh(refreshServer, hDb, 0, 0, 0)
If rc <> 0 Then
Msgbox "Database Could Not Be Refreshed - Error Code " & Cstr(rc), 16, "Error"
End If
Call W32_NSFDbClose(hDb)
End If
End Sub
*********************************************
0 Commenti:
Nessun Commento Trovato