Showing posts with label API. Show all posts
Showing posts with label API. Show all posts

Saturday, July 12, 2008

NNOTESWS.DLL - Notes Progress Bar


Yet another API code. Through this code we can bring the native notes progress bar to our application.


Sub Click(Source As Button)
Dim pb As New LNProgressBar(False)
Dim i As Long


For i=1 To 1000
'we process the elements
Call pb.SetText(Cstr(i)+" Sample Progress Bar","")
Call pb.SetProgressPos(i)
Next
'Terminate the progress bar
Delete pb
End Sub
The below code in the decalration event:
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 )
Const NPB_TWOLINE = 3
Const NPB_ONELINE = 2
Class LNProgressbar
hwnd As Long
Sub New(SecondLineVisible As Integer)
'Set-up the progress bar on the screen
If SecondLineVisible Then
hwnd = NEMProgressBegin(NPB_TWOLINE)
Else
hwnd = NEMProgressBegin(NPB_ONELINE)
End If
End Sub
Sub SetText(FirstLineText As String,SecondLineText As String)
'Display the text in progress bar
NemProgressSetText hwnd, FirstLineTExt,SecondLineText
End Sub
Sub SetProgressPos(Progresspos As Long)
NEMProgressSetBarPos hwnd, ProgressPos
End Sub
Sub SetProgressRange(ProgressMaxElements As Long)
'Set-up the max elements in the progress bar, if you have
'a list with 230 elements then set the MAX to 230 elements.
'For every element you proceed increase the SetProgressPos
'by one to reached 230
NEMProgressSetBarRange hwnd, ProgressMaxElements
End Sub
Sub DeltaPos(DPos As Long)
' This function adds the number in DPOS to the current ProgressPos
NEMProgressDeltaPos hwnd, DPos
End Sub
Sub Delete
'Terminate the progress bar on the screen
NEMProgressEnd hwnd
End Sub
End Class

Wednesday, May 7, 2008

NNOTESWS.DLL - File Open and File Save

Normally when we want to open/save a file through lotus script we will be using the open file dialog and save file dialog. Here is an API alternative for that.

NNOTESWS.DLL is part of the Lotus Notes software and handles the interface side of the Notes client like file open dialog, file save dialog, progress bar etc..

Please Note: I have tried the below code on Version 6.5.4. I haven't tried it on other versions.

Open File Dialog

'Declartion
Declare Function NEMGetFile Lib "nnotesws" ( wHandle As Integer, Byval szFileName As String, Byval szFilter As String, Byval szTitle As String ) As Integer
'On Click
'Declare variables...
Dim szFileName As String*256
Dim szTitle As String
Dim szFilter As String
Dim szSelectedFile As String

Set values...
szFilename = Chr(0)
szTitle = "Open File"
szFilter = "All Files *.* Word Document *.docText Files*.txt" ' a pipe symbol should come after every entry. (szFilter = "All Files pipe *.* pipe Word Document pipe *.doc pipe Text Filespipe .txt pipe"). The symbol gets missed when i publish.
If NEMGetFile( 0, szFileName, szFilter, szTitle) <> 0 Then
szSelectedFile = szFileName
End If

Save As Dialog:

'Declaration
Declare Function NEMPutFile Lib "nnotesws" ( wHandle As Integer, Byval szFileName As String, Byval szFilter As String, Byval szTitle As String ) As Integer
'On Click
'Declare variables...
Dim szFileName As String*256
Dim szTitle As String
Dim szFilter As String

Set values...
szFilename = Chr(0)
szTitle = "Save File"
szFilter = "All Files *.*Word Document *.docText Files*.txt" 'a pipe symbol should come after every entry. (szFilter = "All Files pipe *.* pipe Word Document pipe *.doc pipe Text Filespipe .txt pipe"). The symbol gets missed when i publish.
If NEMPutFile( 0, szFileName, szFilter, szTitle) <> 0 Then
szSaveFile = szFileName
End If