Graphical Progress Bar

This is a way to display a graphical progress bar while processing documents during a collection.
Option Public
Const NPB_TWOLINE% = 1
Declare Function NEMProgressBegin Lib "nnotesws.dll" ( Byval wFlags As Integer ) As Long
Declare Sub NEMProgressDeltaPos Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwIncrement As Long )
Declare Sub NEMProgressEnd Lib "nnotesws.dll" ( Byval hwnd As Long )
Declare Sub NEMProgressSetBarPos Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwPos As Long)
Declare Sub NEMProgressSetBarRange Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwMax As Long )
Declare Sub NEMProgressSetText Lib "nnotesws.dll" ( Byval hwnd As Long, Byval pcszLine1 As String, Byval pcszLine2 As String )
Dim hwnd As Long
Dim i As Long
Dim j As Long
Sub Initialize

' In this example I'll grab a document collection and loop through the documents while displaying the progress.

Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As Notesdocument
Dim collection As NotesDocumentCollection
Dim c As Integer

Set db = s.CurrentDatabase

Set collection = db.AllDocuments '...grab all of the documents in the current database

c = collection.count '...get the number of documents returned

'... create graphical progress bar

hwnd = NEMProgressBegin( NPB_TWOLINE )

NEMProgressSetBarRange hwnd, c

NemProgressSetText hwnd, NTitle, Cstr(c)+" document(s) Found ..."
'..display initial information on the bar

For i = 1 To c

'... Update the progress bar

NEMProgressSetText hwnd, NTitle, "Opening document #" + Cstr(i) + "
... "
NEMProgressSetBarPos hwnd, i

Set doc = collection.GetNthDocument(i)

' any document processing here...


'...Destroy the progress bar when we are finished
NEMProgressEnd hwnd

End Sub

Dig Deeper on Domino Resources



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury