HOWTO: Use VB6 ActiveX dll in Lotus Notes R5?

How do you declare and use an ActiveX dll that was written in VB6 inside of notes?  Do you have to write the VB6 dll in a special way?  How do you declare the dll in Notes and access the functions in the dll?  Examples would be nice...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

just use the following to declare the function:
Declare [ Public | Private ] { Function | Sub } LSname Lib libName [ Alias aliasName ]
          ( [ argList ] ) [ As returnType ]


Declare Function StrFun Lib "lib.dll" _
   (amLStr As LMBCS String) As String

Check the help in notes for more info, under 'Declare' keyword.

even though I'm not a notes-developer (yet ;)) I'm sure to know vb.

Of course you can't use "Declare Function ...." because you don't get a normal-DLL but an ActiveX-Dll.

Isn't there something like CreateObject("") in Notes?

I created a DLL before in VC++, and declare worked.  Maybe u r right, in that aspect though.  CreateObject exists in notes to support OLE automation.

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

ghassan99: Of course you're right, because you did a standard-DLL. In Visual Basic you can ONLY create ActiveX-DLLs.

Therefore you can only access the Classes via

set x = createobject("<PROGID>")

whereas ProgID is for VB-Projects:


set x = createobject("Project1.Class")

Then you should be able to do a

(at least that's how it is accessed from VB-Like languages ... LotusScript-Syntax should be similar)

yes u r right, ActiveX DLLs in VB are based on COM, and they need to be instantiated before using their methods.  Im not sure if your solution above will work in earlier Notes releases (although it is reasonable) but the new Notes release (502c I think) fully supports COM, I believe it will work.

Here my call from LotusScript in Release 4.6.3a which worked corrctly:
Set xlApp = CreateObject("Excel.application")
xlApp.Visible = False

More infos on this you can find here:

This link is to a good article from Iris about COM. There you can finde
a link to this toolkit for COM:\dlcomtk.nsf/Kits/96C695FD78D851E2852568480077D889?OpenDocument

Create the activex dll using at least one class.  If you only need a function, just make it a method of the class.
Register the activex dll by using regsvr32 "activex.dll"

Then just instantiate the object using:
(note: projectID is defined in the project properties dialog.)

There is no need to "declare" the class.

e.g., if you named the project "myproject" and the class "myclass", your LotusScript code might look like this:

dim x as object
dim z as string
dim ans as string

z = "parameter"
set x = creatobject("myproject.myclass")

ans = x.myfunction(z)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.