Manage Learn to apply best practices and optimize your operations.

Replacement for @Command in LotusScript using Notes API's

This tip shows you a replacement for @Command ([fileClose&amp#93;) in LotusScript using Notes API's.

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.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close