Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lotus autologin

Status
Not open for further replies.

jumpjack

Programmer
Jul 28, 2006
79
IT
I'm currently using this code to access a Lotus Notes database from within Microsoft Access:

Code:
Set session = CreateObject("Notes.Notessession")
Set db = session.GETDATABASE(SERVER, DBNAME)
If db.ISOPEN = False Then
    MsgBox ("Impossibile aprire db '" & DBNAME & "'")
End If

At execution of first line, Notes is launched and the password is requested: can I avoid this? I'd like my program to operate in background. Can I programmatically send my password to Lotus, rather than having it locking my app due to missing password? Infact, my program goes on to second line, which raises an error if I don't insert the pass! Adding a delay would not solve the problem, as I want the program to be not user-dependant.

-- Jumpjack --
 

How can I use this code in Microsofr Access?

Code:
WindowName = "Enter Password"
' Define AND Get the handle of the window you're looking for, at the same time.
hWnd_Of_FindWindow = FindWindow(ClassName, VarPtr(WindowName))
hWnd_Of_FindWindow = 1312738
' Process the results of FindWindow
If hWnd_Of_FindWindow > 0 Then
        Call SetForegroundWindow(hWnd_Of_FindWindow)
        Call keybd_event(VK_RETURN, ENTER, 0, 0) ' ‘ENTER’ Press
        Call keybd_event(VK_RETURN, ENTER, WM_KEYUP, 0) ' ‘ENTER’ Release
        Call SendMessageAPI(hWnd_Of_FindWindow, WM_KEYDOWN, 0, 0)
Else
 ' End If
This works in a visual basic standalone app, but it does not inside Microsoft Access, although I also added these declarations:

Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (lpClassName As String, lpWindowName As Long) As Integer
Private Declare Function SendMessageAPI Lib "user32" Alias "SendMessageA" (hWnd As Long, wMsg As Long, wParam As Long, lParam As Long) As Long
Private Declare Sub keybd_event Lib "user32" (bVirtualKey As Byte, bScanCode As Byte, dwFlags As Long, dwExtraInfo As Long)
Private Declare Sub SetForegroundWindow Lib "user32" (hWnd As Long)

-- Jumpjack --
 
Try this

Code:
Set session = CreateObject("Notes.Notessession")
[b]Call session.Initialize(strYourPassword)[/b]
Set db = session.GETDATABASE(SERVER, DBNAME)
If db.ISOPEN = False Then
    MsgBox ("Impossibile aprire db '" & DBNAME & "'")
End If






--------------------------------------------------------------------
How can I believe in God when just last week I got my tongue caught in the roller of an electric typewriter?
---------------------------------------------------------------------
 
My version (4.6) does not support session.initialize ! :-(

-- Jumpjack --
 
hmmm install a Notes R5 client or above - you will be able to connect to an R4.x server/mailbox/db also

--------------------------------------------------------------------
How can I believe in God when just last week I got my tongue caught in the roller of an electric typewriter?
---------------------------------------------------------------------
 
I can't install anything on my office PC, only use what is available.
So I need a workaround.

Why does the API method not work?

-- Jumpjack --
 
I have no idea

Is using a user ID with no password an option ?

--------------------------------------------------------------------
How can I believe in God when just last week I got my tongue caught in the roller of an electric typewriter?
---------------------------------------------------------------------
 
no.
I can't.
The only option is using API to control the password dialog, IMHO.
But HOW?

-- Jumpjack --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top