About This Code
Brief Description:
Exit Notes Without Using File-Exit or the @Command({FileExit})
Contributor:
Andrew Jones
Last Modified:
17 Jun 2002
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Declare Function FindWindow Lib "user32" Alias "FindWindowA"(Byval lpClassName As String, Byval lpWindowName As String) As Long
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (Byval hwnd As Long, Byval wMag As Long, Byval wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10
Dim session As New notessession
Dim user As String
Dim winHwnd As Long
Dim retVal As Long
user = session.commonusername
winHWnd = FindWindow("Notes","Welcome - Lotus Notes")
If winHwnd <> 0 Then
Messagebox "Goodbye " & Cstr(user),MB_OK,"Message From Hal"
PostMessage winHwnd, WM_CLOSE, 0&, 0&
Else
Messagebox (Cstr(Err))
End If
Usage / Example