LotusScript to C API Programming Guide

rtLib Domino Rich Text Management template
Show details for ContentContent
Ready-to-use samples
Show details for Online resourcesOnline resources
Happy readers




Hosted by Prominic.NET, Inc.
Main topic: Visual Basic and NotesSession dilemma

Visual Basic and NotesSession dilemma (by Kenneth Haggman, 06/13/2008 05:13:57 AM)

Hi Normunds,

I am using Visual Basic to access Notes.

To create a NotesSession from VB, I will normally use:

Dim session As NotesSession

Set session = New NotesSession


This will give me a 'proper' NotesSession object which can be used for all the stuff you'd normally use it for, like session.GetDatabase for example.

However, this only works if the notes.ini file is located in the Notes program executable directory. While this is the normal case, it is not uncommon for users to start Notes pointing to a notes.ini file in another location.

Well, to circumvent that problem, I can use the NotesInitExtended API. It needs to be fed 2 arguments like this:

Dim strArgs As String

strArgs = "c:\notesprogramdirectory" & Chr(0)

strArgs = strArgs & "=" & "d:\notesinidir\myspecialinifile.ini" & Chr(0)

iReturn = NotesInitExtended(2, strArgs)

I will also need to use NotesTerm to close the session.

My question now is 'what about the NotesSession object'?

The API's above will allow me to use the C API's from VB but I have completely lost the NotesSession object haven't I?

Can I get a NotesSession by first calling the NotesInitExtended API as specified above and then initialize a NotesSession like I normally do?

Or will that crash completely?

Essentially, my question is if these two techniques are mutually exclusive.

Must I use one and one only or can they be combined?

Thankful for any thoughts here.

// Ken Haggman, Noteshound.