Bernd Hort posted a tipp earlier today on how to programmatically check is the design of a database is hidden. Bernd said that there is no method in LotusScript to do such.
I did a little research and found an older DominoPower article. In Notes 5 IBM introduced some enhancements to the Notesreplication class. Amongst other methods and properties there was a HideDesign property. Anybody knows what has happened to this property?
And I found some Notes API calls to do the trick. I modified the code and here is my solution on how to programmatically check a databases design flag.
Const APIModule = "NNOTES" ' Windows/32 only
Const REPLFLG_HIDDEN_DESIGN = &H0020
Type ReplicaInfo
ID(1) As Long
Flags As Integer
CutoffDays As Integer
CutoffDate(1) As Long
End Type
Declare Function NSFDbOpen Lib APIModule Alias "NSFDbOpen" _
( Byval P As String, H As Long) As Integer
Declare Function NSFDbClose Lib APIModule Alias "NSFDbClose" _
( Byval H As Long) As Integer
Declare Function OSPathNetConstruct Lib APIModule Alias "OSPathNetConstruct" _
( Byval Z As Long, Byval S As String, Byval F As String, Byval P As String) As Integer
Declare Function NSFDbReplicaInfoGet Lib APIModule Alias "NSFDbReplicaInfoGet" _
( Byval H As Long, R As ReplicaInfo) As Integer
Declare Function NSFDbReplicaInfoSet Lib APIModule Alias "NSFDbReplicaInfoSet" _
( Byval H As Long, R As ReplicaInfo) As Integer
Function IsDesignHidden ( db As NotesDatabase ) As Boolean
IsDesignHidden = False
Dim hDB As Long
Dim R As ReplicaInfo
p$ = Space(256)
OSPathNetConstruct 0, db.Server, db.FilePath, p$
NSFDbOpen p$, hDB
NSFDbReplicaInfoGet hDB, R
If ( Not R.Flags And REPLFLG_HIDDEN_DESIGN) = 0 Then
IsDesignHidden = True
End If
NSFDbClose hDB
End Function
Now you can call the function. It will return true is design is hidden and false if the database has open design.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim rep As NotesReplication
Set db = session.CurrentDatabase
Msgbox IsDesignHidden(db)
End Sub