This tip shows you a replacement for @Command ([fileClose]) in LotusScript using Notes API's.
A database opened in UI (not in the context of NotesUI classes) can be closed programmatically using @Command ([FileCloseWindow]). However, when this database needs to be closed using LotusScript, such a method is unavailable.
The script below highlights the usage of Notes' API's to achieve the functionality using LotusScript itself.
' dll function declaration Declare Function NEMGetCurrentSubprogramWindow Lib "nnotesws.dll" () As Long Declare Function NEMStopSubprogramWindow Lib "nnotesws.dll" (Byval hwnd As Long) As Integer Declare Function NEMActivateSubprogram Lib "nnotesws.dll" Alias "NEMActivateSubprogram" (Byval hwnd As Long) As Long 'include the following whereever u would like to close the database. Sub closeWindow () Dim wHandle As Long wHandle = NEMGetCurrentSubprogramWindow Call NEMActivateSubprogram(wHandle) Call NEMStopSubprogramWindow(wHandle) End Sub Example usage Sub Click(Source As Button) 'include the following whereever u would like to close the database immediately. Call closeWindow () End Sub
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Lak. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.