Wer schon einmal bei etlichen Datenbanken die Einstellungen für das designtemplate manuell ändern musste, der wird diese kleine Klasse sicherlich gut gebrauchen können ( für den Fall, dass er noch einmal eine andere Schablone eintragen muss )
Const INFOPARSE_TITLE = 0
Const INFOPARSE_CATEGORIES = 1
Const INFOPARSE_CLASS = 2
Const INFOPARSE_DESIGN_CLASS = 3
Const NSF_INFO_SIZE = 128
Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval szDBName As String, dwDBHandle As Long) As Integer
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval dwDBHandle As Long) As Integer
Declare Function W32_NSFDbInfoGet Lib "nnotes.dll" Alias "NSFDbInfoGet" (Byval dwDBHandle As Long, Byval szInfoBuffer As String) As Integer
Declare Function W32_NSFDbInfoSet Lib "nnotes.dll" Alias "NSFDbInfoSet" (Byval dwDBHandle As Long, Byval szInfoBuffer As String) As Integer
Declare Sub W32_NSFDbInfoModify Lib "nnotes.dll" Alias "NSFDbInfoModify" (Byval szInfoBuffer As String, Byval wWhat As Integer, Byval szNewVal As String)
Declare Sub W32_NSFDbInfoParse Lib "nnotes.dll" Alias "NSFDbInfoParse" (Byval szInfoBuffer As String, Byval wWhat As Integer, Byval szRetVal As String, wRetLen As Integer)
Class NotesTemplateSettings
Private szInfoBuffer As String * NSF_INFO_SIZE
Private szDatabase As String
Private dwDBHandle As Long
Private rc As Integer
Private wFlag As Integer
Sub New (inpNotesDatabase As NotesDatabase)
wFlag = False
szInfoBuffer = String(NSF_INFO_SIZE,0)
If inpNotesDatabase Is Nothing Then
Exit Sub
End If
If inpNotesDatabase.Server = "" Then
szDatabase = inpNotesDatabase.filepath
Else
szDatabase = inpNotesDatabase.Server + "!!" + inpNotesDatabase.Filepath
End If
rc = W32_NSFDbOpen(szDatabase,Me.dwDBHandle)
If rc <> 0 Then
Exit Sub
End If
rc = W32_NSFDbInfoGet(dwDBHandle, szInfoBuffer)
If rc <> 0 Then
Call W32_NSFDbClose(dwDBHandle)
Exit Sub
End If
wFlag = True
End Sub
Sub Delete
If wFlag Then W32_NSFDbClose(dwDBHandle)
End Sub
Public Property Get DesignTemplateName As String
If Not wFlag Then Exit Property
Dim szRetVal As String * NSF_INFO_SIZE
Dim rc As Integer
szRetVal = String(NSF_INFO_SIZE,0)
Call W32_NSFDbInfoParse (szInfoBuffer, INFOPARSE_DESIGN_CLASS ,szRetVal, NSF_INFO_SIZE -1)
DesignTemplateName = Left(szRetVal,Instr(szRetVal,Chr(0))-1)
End Property
Public Property Get TemplateName As String
If Not wFlag Then Exit Property
Dim szRetVal As String * NSF_INFO_SIZE
Dim rc As Integer
szRetVal = String(NSF_INFO_SIZE,0)
Call W32_NSFDbInfoParse (szInfoBuffer, INFOPARSE_CLASS ,szRetVal, NSF_INFO_SIZE -1)
TemplateName = Left(szRetVal,Instr(szRetVal,Chr(0))-1)
End Property
Public Property Set DesignTemplateName As String
If Not wFlag Then Exit Property
Call W32_NSFDbInfoModify(szInfoBuffer, INFOPARSE_DESIGN_CLASS, DesignTemplateName)
rc = W32_NSFDbInfoSet(dwDBHandle,szInfoBuffer)
If rc <> 0 Then
Exit Property
End If
End Property
Public Property Set TemplateName As String
If Not wFlag Then Exit Property
Call W32_NSFDbInfoModify(szInfoBuffer, INFOPARSE_CLASS, TemplateName)
rc = W32_NSFDbInfoSet(dwDBHandle,szInfoBuffer)
If rc <> 0 Then
Exit Property
End If
End Property
End Class