Page 1 sur 1

StoredForms

MessagePublié: 01 Août 2005 à 12:44
par Stephane Maillard
[syntax="ls"]Const wAPIModule = "NNOTES" ' Windows/32



Const NOTE_CLASS_FORM = 4

Const TPL_FLAG_BOILERPLATE = &H20



Type BlockID

hPool As Long

Block As Integer

End Type



Declare Private Sub IDDestroyTable Lib wAPIModule Alias "IDDestroyTable" _

( Byval hT As Long)

Declare Private Function IDScan Lib wAPIModule Alias "IDScan" _

( Byval hT As Long, Byval F As Integer, ID As Long) As Integer



Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" _

( Byval P As String, hDB As Long) As Integer

Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" _

( Byval hDB As Long) As Integer

Declare Private Function NSFDbGetModifiedNoteTable Lib wAPIModule Alias "NSFDbGetModifiedNoteTable" _

( Byval hDB As Long, Byval C As Integer, Byval S As Currency, U As Currency, hT As Long) As Integer



Declare Private Function NSFNoteOpen Lib wAPIModule Alias "NSFNoteOpen" _

( Byval hDB As Long, Byval N As Long, Byval F As Integer, hNT As Long) As Integer

Declare Private Function NSFNoteClose Lib wAPIModule Alias "NSFNoteClose" _

( Byval hNT As Long) As Integer



Declare Function NSFItemInfo Lib wAPIModule Alias "NSFItemInfo" _

( Byval hNT As Long, Byval N As String, Byval nN As Integer _

, iB As BlockID, D As Integer, vB As BlockID, nV As Long) As Integer

Declare Private Function NSFItemGetText Lib wAPIModule Alias "NSFItemGetText" _

( Byval hNT As Long, Byval N As String, Byval T As String, Byval nT As Integer) As Integer



Declare Private Function OSLockObject Lib wAPIModule Alias "OSLockObject" _

( Byval H As Long) As Long

Declare Private Sub OSUnlockObject Lib wAPIModule Alias "OSUnlockObject" _

( Byval H As Long)

Declare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" _

( Byval zP As Long, Byval S As String, Byval F As String, Byval P As String) As Integer



Declare Sub Peek Lib wAPIModule Alias "Cmovmem" _

( Byval P As Long, N As Any, Byval B As Long)



Declare Private Sub TimeConstant Lib wAPIModule Alias "TimeConstant" _

( Byval C As Integer, T As Currency)





Function StoredForms(db As NotesDatabase) As Variant

Redim S(0) As String

got% = 0



With db

np$ = Space(1024)

OSPathNetConstruct 0, db.Server, db.FilePath, np$

End With



Dim hDB As Long

NSFDbOpen np$, hDB



Dim ever As Currency, last As Currency

TimeConstant 2, ever



Dim hT As Long

NSFDbGetModifiedNoteTable hDB, NOTE_CLASS_FORM, ever, last, hT



Dim RRV As Long

done = (IDScan(hT, True, RRV) = 0)

While Not done

If RRV > 0 Then

Dim hNT As Long

NSFNoteOpen hDB, RRV, 0, hNT

Dim iB As BlockID, vB As BlockID

NSFItemInfo hNT, "$Info", 5, iB, dt%, vB, nv&

If Not vB.hPool = 0 Then

p& = OSLockObject(vB.hPool) + vB.Block

Peek p& + 6, flag%, 2

OSUnlockObject vB.hPool

If Not (flag% And TPL_FLAG_BOILERPLATE) = 0 Then

title$ = Space(256)

NSFItemGetText hNT, "$TITLE", title$, 256

Redim Preserve S(got%)

S(got%) = Strleft(title$, Chr$(0))

got% = got% + 1

End If

End If

NSFNoteClose hNT

End If

done = (IDScan(hT, False, RRV) = 0)

Wend



IDDestroyTable hT

NSFDbClose hDB



If Not got% = 0 Then StoredForms = S

End Function[/syntax]