We help IT Professionals succeed at work.

Object library not registered

ampapa
ampapa asked
on
I am running into an error - "Object Library not Registered" when running a program in VB5 that uses Lotus Notes via OLE. The same program runs perfectly fine on a Win98 box but will not get past this error on an NT4 box. Can anybody give me some ideas to help solve this problem?

TIA ampapa
Comment
Watch Question

Commented:
my suggestion would be to get dependency walker from http://www.dependencywalker.com/

it will show you what dependencies your app needs to run... I'm guessing that you have not correctly registered the dll required to use the lotus notes object.

figure out which dll you need and then run regsvr32 <path to dll>

or better yet, add the dll to your setup package.

good luck
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
You are saying your answer., there is not library on target machine.
Which version of Notes you are using.
You need , at least, lotus notes installed in that machine.
Diferent version of notes uses diferent libraries.

Author

Commented:
Thanks for the reply's.

I'll try the "Dependancy Walker" app when I get back to the office in the A.M.

The version of Notes is 4.6.3 and it is installed on the target machine.
TimCotteeHead of Software Services
CERTIFIED EXPERT

Commented:
AS Richie says different versions of notes use different libraries. It is possible that you have code developed on R5 and are trying to implement it on 4.6.3. To be able to help further, we need to know what declarations are being made in the code and what lines generate the error. It is sometimes feasible to get around such problems by using Late-Binding rather than early-binding. E.g., declare all objects as Object rather than Domino.NotesSession for example. As long as the different versions of the libraries have the same properties and methods with the same parameters then this will work satisfactorily on multiple versions. It has its downsides in terms of ease of writing the code but you cannot have everything. I tend to declare stuff early bound to develop and test and then make it late bound before release so that these problems don't occur as frequently especially when using Notes automation as we have a mix of 4.x and 5.x clients and servers in my organisation.

Author

Commented:
Tim & Richie: Here is a peek at the code.

Set notesSession = CreateObject("Notes.NotesSession")
Set notesDatabase = notesSession.GETDATABASE("", "names.nsf")
Set notesDocument = notesDatabase.CREATEDOCUMENT
Set notesRTItem = notesDocument.CREATERICHTEXTITEM("File")
...

(This is the line that errors)

Call notesRTItem.EMBEDOBJECT(Embed_Type, "", Excel_Dir & "memo.xls", "Attached_File")


bobbit31 - I ran the Dependancy Walker this morning. It is very detailed which is good and bad. Good if you know what you're looking for bad if you don't. I was able to run a profile and now have some results. Should I be looking at the Module section or the Profile section for my missing DLL?

Thanks for you help.




Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
As Tim saids, the "best" approach is using late-binding if you have mixed Notes client's version.
But, just to clarify, some methods of Notes Domino aren't implemented in previous version (like .initialize ("password") method, which is a pity).
There is two main libraries:
Lotus Domino Objects : Version 5.x (domobj.tlb)
Lotus Notes Automation classes: version 4.x, 5.x (notes32.tlb)
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
I did (just like Tim) a little example of those matters, you could take a look at him, or mine at www.angelfire.com/realm/vb-shared/index.html
It shows how to attach files to mails.
Cheers
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Pardon, Tim site is in another place ;)
Sorry, i don't remember the link but sure he does.
;)

Author

Commented:
The version of Notes is not an issue 4.6.3 is currently what is running and the program will run only on this box. Are you saying that I should register the library you listed above? (notes32.tlb)I do see the "Notes automation class" listed as an object in the viewer in VB does that mean it has been registered?

Author

Commented:
The version of Notes is not an issue 4.6.3 is currently what is running and the program will run only on this box. Are you saying that I should register the library you listed above? (notes32.tlb)I do see the "Notes automation class" listed as an object in the viewer in VB does that mean it has been registered?

Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
If it is listed, it is registered.
Take a look at site posted. It gives you clues and sample code on how to create mails with attachments.
TimCotteeHead of Software Services
CERTIFIED EXPERT

Commented:
Richie, it is http://www.geocities.com/TimCottee goto downloads and then the appropriate module to download the sample.

Author

Commented:
I don't see how the coding could be the issue seeing as it runs on a Win98 box currently and also ran on this NT box in the past but was recently rebuilt. If it was crashing on both boxes previously I would certainly be looking at recoding the project but it doesn't make sense? Richie aren't you still making OLE references in your code by creating a NotesSession?
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
I did OLE references when work with version 4.x and COM references with version 5.x
The approach that works with both version is using Lotus Notes Automation classes and declare each object variable "as object".
In my example, i use two completely separate forms to show how. You only need to use copy'n'paste stuff.
maybe i misunderstood you question.
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
I actually ran that example on win98/nt4/2000 without any problem.

Author

Commented:
I think my problem is less with the coding and more with the registration or a missing .DLL, maybe even a corrupt .DLL?

All had been running well until my NT box crashed. Now I get the "Object Library not Registered" error with no indication of which .DLL is missing or causing the error.

My problem or question keeps circulating around how do I determine what "Library" my program is looking for? If in my case the "Library is as indicated above - "Lotus Notes Automation classes: version 4.x, 5.x (notes32.tlb)" Should I try to re-register this file or assume it is corrupt? Isn't this the only "Library" used via OLE and VB in my case?


Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Did you re-intalled Notes? It could be a good choice.
By the way, if i remember well that dll is not automatically registered during Notes instalation.

Author

Commented:
I also had the same thought, so I tried a reinstall on Notes to no avail.

Can I do a regular install on the DLL by using regsvr32?

"regsvr32 c:\notes\notes32.tlb"

I get an error loading via the regsvr32.

Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Something like "Can't load library..." or something like that?
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:

Author

Commented:
"Load library (C:\notes\notes32.tlb)failed." Get last error...

I spotted the article on ElemtKjournals site but in the section where they are registering the DLL for Notes 5 you'll notice it's a DLL not a TLB? Does that mean there is an equivalent DLL in notes 4?

Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
We can't register a tlb file.
We need to reg dll which i don't rememeber its name!

Commented:
which is what dependency walker is for ;)

Author

Commented:
bobbit31 - how do I interpret dependancy walker to determine what DLL needs to be registered?
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Not registered, but used by exe, dll or ocx.

Commented:
well like richie said, you are looking for either a dll or ocx.  Maybe try looking for something that is similar to notes.dll or lnotes.dll etc... etc...

if not, make a button on your form or something that executes the code that is causing the error... that way when you click on the button you can see what is being called and narrow your search further.  Sorry, I haven't used it in a long time so i don't exactly remember the interface, and usage. (i just know it worked for me before)

good luck!
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
I think you could use this approach:
Do you have exe that causes problem, right?
Use dependency walker OVER that exe.
DW will shows you which dlls (besides MSVBVMx0.dll) are used by your program.
It's just a matter of common sense to read their names and do a try with each one.
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
That doesn't work.
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Just a guess, are you sure that this variable has something "inside":?

Set notesDatabase = notesSession.GETDATABASE("", "names.nsf")

add this little line after that:

msgbox notesdatabase.isopen
IT Operations
CERTIFIED EXPERT
Commented:
I did a test with this code:

Dim NOTESSESSION As Object
Dim NOTESDATABASE As Object
Dim NOTESDOCUMENT As Object
Dim notesRTItem As Object
Set NOTESSESSION = CreateObject("Notes.NotesSession")
Set NOTESDATABASE = NOTESSESSION.GETDATABASE("", "names.nsf")
Set NOTESDOCUMENT = NOTESDATABASE.CREATEDOCUMENT
Set notesRTItem = NOTESDOCUMENT.CREATERICHTEXTITEM("Body")
'...
Dim Embed_Type As Long
Embed_Type = 1454
'(This is the line that errors)

Call notesRTItem.EMBEDOBJECT(Embed_Type, "", "c:\IBDSYMB.TXT", "Attached_File")

Author

Commented:
Richie, you have been a great help. I tried the small clip of code you posted and it worked! Unfourtunately I was to busy looking at the larger picture and wasn't focusing on the smaller picture by testing small segments of code and debugging from there.

My problem obviously is in the file attachment variable? But at least I know what it is. I also have come to the conclusion that the "Object not registered" is a bug in Lotus notes. By checking the "Locals" window with the working segment of code I still get the same error about the Lotus notes "Object not registered" . So, I have to conclude that even though the object has a "plus" sign next to it and it has been created we can't debug it.

Thanks for sticking with me.
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Uff!, at least!
Bug thing: it is extremely possible!
Why don't you upgrade to version 5.x, it's a real COM component and benefits are great (You can loggin without user intervention is a pearl and you don't need to close Notes window by hand among some others)
Cheers
You are welcome anytime ;)

Commented:
good job richie! you definitely deserved those points!
ampapa, glad you got it working and sorry if my first suggestion through you off a little ;)
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Thanks bobbit, but your first comment wasn't so far. VB was responding with wrong message in first place, don't you think so?

Commented:
yeah... it definitely sounded like a missing dependency file to me... oh well :)

Author

Commented:
I appreciated all of your inputs. Sorry I can't give both points.

Thanks again Richie and bobbit31.

ampapa