

![]() |
||||||||||||
![]()
![]() ![]()
![]() Just as Windows has a set of DLLs, Lotus Notes has a set of DLLs. Notes uses DLLs to collect procedures which are then called as needed. You can use many of these procedures in any Notes application. In fact most software will include a set of libraries. If you know what functions are contained within these libraries you can use the functions and sub routines in your code to help you interact better with that particular software. In the next activity we will utilize several functions within the NNOTESWS.DLL library to create a progress bar across our screen. This bar could come in handy when you want to present a visual display of work in progress, like the processing of many documents to produce a report. To use these libraries you follow the same set of rules that were previously outlined. When declaring external functions keep in mind the scope your function required for your application. If you only need the external routine in a single Button method, then it's best to add a declare statement in that method's (Declarations). If you need the routine in more than one method for an object, then declare it in the form's (Globals) window. If you need the routine in several forms, declare it in a Script Library and Use the library as needed.
Declaring External Procedures External procedures can be declared from any LotusScript Module or object. They can be declared either local to the current object, or global to the application. The external procedures are declared as either Function or Sub using one of the following:
Example: This example demonstrates the declaration of the progress bar function located in NNOTESWS.DLL file: Declare Function NEMProgressBegin Lib "nnotesws.dll" ( Byval wFlags As Integer ) As Long
The NEMProgressBegin function creates the progress bar dialogbox. If the parameter wFlags is odd, then the dialog bar created by NEMProgressBegin will contain two text variables for use by the function NemProgressSetText. If wFlags is even it will only contain the first string parameter of NemProgressSetText.
The NemProgressSetText function is used to display two separate text fields on the dialogbox created by the NEMProgressBegin function. Note: If wFlags = 32 then no string parameters are displayed and the bar runs along the bottom of the screen.
(Declarations) Const NPB_TWOLINE% = 1 '-- Procedures in nnotesws.dll Declare Function NEMProgressBegin Lib "nnotesws.dll" ( Byval wFlags As Integer ) 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 ) Sub Click(Source As Button) Dim hwnd As Long Dim i As Long Dim j As Long 'Create the progress bar hwnd = NEMProgressBegin( NPB_TWOLINE ) 'Set the bar range - the default is 100 NEMProgressSetBarRange hwnd, 200 'Display text on the dialog. NemProgressSetText hwnd, "Calculating ...", "Start" For i = 0 To 200 For j = 0 To 5000 'artificial delay for the example !! Next j 'Update the bar position NEMProgressSetBarPos hwnd, i 'Update the text at twenty five percent If i = 50 Then NEMProgressSetText hwnd, "Calculating ....", "25%" End If 'Update the text at fifty percent If i = 100 Then NEMProgressSetText hwnd, "Calculating .....", "50 %" End If 'Update the text at seventy five percent If i = 150 Then NEMProgressSetText hwnd, "Calculating ......", "75 %" End If Next 'Destroy the dialog when we're done NEMProgressEnd hwnd End Sub ![]() |